The information in this article applies to:
SYMPTOMSIf two or more threads display modal dialog boxes at the same time inside an MFC regular dynamic-link library (DLL) (USRDLL), the following ASSERT may be generated in AfxWndProc, on Wincore.cpp, line 365 in Visual C++ 6.0 (line 368 in Visual C++ 5.0, line 360 in Visual C++ 4.2):
This ASSERT occurs only if one of the threads was created outside of the
DLL.
The probability of this problem occurring increases with the number of threads and modal dialog boxes. CAUSE
When AfxGetThread() is called in an MFC regular DLL from a secondary thread
that was not created inside the DLL, it returns the CWinApp object for the
DLL because a CWinThread object was not created for the thread in the
context of the DLL.
RESOLUTIONOne possible work around is to spawn secondary threads, which in turn display the modal dialog boxes. Each new thread created inside the MFC regular DLL will have a new CWinThread object and a separate message pump. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATION
In Visual C++ versions earlier than Visual C++ 4.2, MFC regular DLLs could be accessed only from the same thread that loaded the DLL. Support for
external secondary threads was added in Visual C++ 4.2.
REFERENCESFor additional information, please see the following article(s) in the Microsoft Knowledge Base: Q122676 Multiple Threads and MFC _USRDLLs © Microsoft Corporation 1997, All Rights Reserved. Additional query words:
Keywords : kbDLL kbMFC kbThread kbVC420bug kbVC500bug kbVC600bug |
Last Reviewed: April 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |