The information in this article applies to:
SUMMARY
MFC maintains three different types of data: process specific data, module
specific data, and thread specific data. Because there can be more than one
MFC module or thread in a process, MFC maintains state variables to keep
track of the current module and thread instance data.
MORE INFORMATION
Each MFC module state is tied to an initialization of the shared MFC DLL.
The application, as well as each regular MFC DLL and MFC ActiveX control,
maintains a separate initialization of MFC. MFC extension DLLs use the
module state of the calling application or DLL.
Each of these macros prints out a message in the output window, identifying
the current module or thread state. Double-clicking on the message takes
you to the source line where they appear.
NOTE: you may need to run the MFC Tracer utility from the DevStudio Tools menu, and turn off support for "Multiple application debugging," as this prepends the module name to the debug string sent to the output window. MODULE_TRACE() is most useful when you place it in every CWinApp::InitInstance() in the process, as well as where the object that is causing the ASSERTs is being created and destroyed. THREAD_TRACE() works like MODULE_TRACE(), but you should also place it in the CWinThread::InitInstance() of secondary threads. MODULE_TRACE() returns the same value in every function in the same DLL or .exe file. THREAD_TRACE() returns the same value in every method for a CWnd, or CGdiObject-derived class. If not, there is a problem. You can call the macros more often to help isolate the problem. Once the problem has been isolated, see the following references on how to fix or resolve the problem. REFERENCESFor more information on MFC Module State, please see: Visual C++ Online Documentation: Microsoft Foundation Class Reference; MFC Technical Notes; TN058: MFC Module State Implementation.For more information on AFX_MANAGE_STATE, search on AFX_MANAGE_STATE in the VC++ 5.0 Online Documentation. For additional information, please see the following articles in the Microsoft Knowledge Base: Q127074 How to Use AFX_MANAGE_STATE in an OLE Control(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Kelly Marie Ward, Microsoft Corporation. © Microsoft Corporation 1998, All Rights Reserved. Additional query words: Afx AfxModuleState ModuleState AfxThreadState ThreadState kbDLL kbMFC kbThread kbVC400 kbVC410 kbVC420 kbVC500
Keywords : |
Last Reviewed: July 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |