The message box is not displayed with the ExitInstance function of a dialog-based MFC application (253130)
The information in this article applies to:
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ 2005 Express Edition
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q253130 Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. Microsoft Visual C++ 2005 supports both the managed code
model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model. SYMPTOMS When you try to display a message box in the ExitInstance function of a dialog-based Microsoft Foundation Classes (MFC)
application, you don't see the message box displayed. Also, if you place any
window creation code after the DoModal call in your InitInstance function, you don't see the window. CAUSE Destruction of the main window causes a WM_QUIT message to
be posted to the main application thread indicating to the operating system
that the thread is to be terminated. Any window created after this is destroyed
immediately after creation resulting in a brief flash. RESOLUTION To work around this problem, comment out the line in the InitInstance function that assigns the m_pMainWnd function to your dialog as follows:
// m_pMainWnd = &dlg;
Also, and instead of using message boxes, you could use the MFC TRACE macros to display information in the debug output window for
debugging purposes. STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 1/7/2006 |
---|
Keywords: | kbtshoot kbDlg kbprb KB253130 kbAudDeveloper |
---|
|