The information in this article applies to:
SYMPTOMSIn a default dialog-based application, windows created after returning from DoModal flash and disappear. CAUSE
In an MFC application when the main window associated with the application
is destroyed, a WM_QUIT message is posted to the application. This message
is posted by calling AfxPostQuitMessage from CWnd::OnNcDestroy for the main
window. AfxPostQuitMessage calls PostQuitMessage, which performs some
processing and then posts the WM_QUIT message to the application. RESOLUTIONChange the line that sets the m_pMainWnd to point to dialog object, into a comment. Or set m_pMainWnd for the CWinApp-derived object to NULL before control gets to CWnd::OnNcDestroy for the dialog object. One way of doing this is to override OnNcDestroy for the CDialog-derived object. In the overridden function, set the m_pMainWnd to NULL before calling the base class. STATUSThis behavior is by design. MORE INFORMATIONThe following code can be implemented in the CDialog-derived class to prevent PostQuitMessage() from being called when the dialog box in a default dialog-based application is dismissed. Steps to Resolve Behavior
Additional query words: messagebox
Keywords : kbcode kbMFC kbVC200 kbVC210 kbVC220 kbVC400 kbVC500 kbVC600 |
Last Reviewed: July 27, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |