The information in this article applies to:
SYMPTOMS
When using ClassWizard to add Methods and Properties to an ATL interface in a MFC Application, ClassWizard will add the following line to the top of each function:
AfxGetStaticModuleState() is used to maintain MFC global state information inside a MFC regular DLL. Using AfxGetStaticModuleState() in an MFC EXE will not change to the correct module state. In addition, it will cause the MFC DLL startup source to be linked into the EXE increasing it's size.AfxGetAppModuleState() should be used in MFC EXEs. RESOLUTION
Change the AFX_MANAGE_STATE line to read:
If the same code is used in an EXE and MFC regular DLL, use a #define:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATION
MFC classes which use global and thread based MFC data need to use a specific MFC module state. As a result, entry points need to switch module states using the AFX_MANAGE_STATE macro to the module state associated with the EXE or DLL. REFERENCES
For more information on MFC Module States, see the MFC technote TN058: MFC Module State Implementation. © Microsoft Corporation 1999, All Rights Reserved. Additional query words: AFX_MANAGE_STATE, AfxGetStaticModuleState, AfxGetAppModuleState
Keywords : kbATL kbMFC kbVC600 kbGrpMFCATL kbArchitecture |
Last Reviewed: June 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |