This is a response to the following topic that appears to be older than
30 days:

The original post is here:
http://groups.google.com/group/comp....003ace77d96fa4


Basically what you need to do is the following:


DWORD dwThreadId = GetWindowThreadProcessId(GetSafeHwnd(), NULL);
EnumThreadWindows(dwThreadId,(WNDENUMPROC)EnumThre adWndProc,(LPARAM)0);



BOOL CALLBACK EnumThreadWndProc(HWND hWnd,
LPARAM lParam)
{
CString strClassName;

::GetClassName(hWnd, strClassName.GetBuffer((_MAX_PATH + 1) *
sizeof(TCHAR)), _MAX_PATH);
strClassName.ReleaseBuffer();

if (strClassName.CompareNoCase(_T("#32770")) == 0)
{
::SendMessage(hWnd, WM_COMMAND, IDCANCEL, (LPARAM)hWnd);
::SendMessage(hWnd, WM_COMMAND, IDNO, (LPARAM)hWnd);
}
return TRUE;
}


In the thread proc, you need to send a WM_COMMAND message to your modal
dialog to shut it down. Since you do not know exactly what dialogs to
kill (could be a bunch: message boxes, your own dialogs etc), initially
you send an IDCANCEL command, in case you found a message box that
supports IDCANCEL attribute, and if IDCANCEL fails, you send out an
IDNO command that will shut down all your modal message boxes with the
IDYESNO attributes (those dialogs do not support IDCANCEL).