The information in this article applies to:
SYMPTOMSIf an MFC dynamic-link library (DLL) is loaded with LoadLibrary() and later released with FreeLibrary(), it will not be possible to load the library a second time during the same invocation of the main program. The library fails during initialization. CAUSEFour window classes are registered by the MFC initialization code. Windows NT 3.1 does not automatically unregister window classes that were registered by a dynamically loaded DLL when the DLL's reference count reaches zero and the DLL is removed from memory. If the DLL is loaded a second time, the RegisterClass call in the initialization code fails because the classes are still registered. RESOLUTION
The workaround is to unregister the window classes in the destructor for
the DLL CWinApp object. The sample code below is an example of the code
that is needed. STATUSMicrosoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem was corrected in MFC 3.0, included with Visual C++ 32-bit Edition, version 2.0. Sample Code
Additional query words: 1.00 2.00 2.10 USRDLL
Keywords : kbDLL kbMFC kbVC kbVC100bug kbVC200fix kbGrpMFCATL |
|
Last Reviewed: November 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |