title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AFX_EXTENSION_MODULE Structure | Microsoft Docs |
11/04/2016 |
|
article |
|
|
|
b85a989c-d0c5-4b28-b53c-dad45b75704e |
11 |
mikeblome |
mblome |
ghogen |
The AFX_EXTENSION_MODULE
is used during initialization of MFC extension DLLs to hold the state of MFC extension DLL module.
struct AFX_EXTENSION_MODULE
{
BOOL bInitialized;
HMODULE hModule;
HMODULE hResource;
CRuntimeClass* pFirstSharedClass;
COleObjectFactory* pFirstSharedFactory;
};
bInitialized
TRUE if the DLL module has been initialized with AfxInitExtensionModule
.
hModule
Specifies the handle of the DLL module.
hResource
Specifies the handle of the DLL custom resource module.
pFirstSharedClass
A pointer to information (the CRuntimeClass
structure) about the DLL module's first runtime class. Used to provide the start of the runtime class list.
pFirstSharedFactory
A pointer to the DLL module's first object factory (a COleObjectFactory
object). Used to provide the start of the class factory list.
MFC extension DLLs need to do two things in their DllMain
function:
-
Call AfxInitExtensionModule and check the return value.
-
Create a CDynLinkLibrary object if the DLL will be exporting CRuntimeClass objects or has its own custom resources.
The AFX_EXTENSION_MODULE
structure is used to hold a copy of the MFC extension DLL module state, including a copy of the runtime class objects that have been initialized by the MFC extension DLL as part of normal static object construction executed before DllMain
is entered. For example:
[!code-cppNVC_MFC_DLL#2]
The module information stored in the AFX_EXTENSION_MODULE
structure can be copied into the CDynLinkLibrary object. For example:
[!code-cppNVC_MFC_DLL#5]
Header: afx.h
Structures, Styles, Callbacks, and Message Maps
AfxInitExtensionModule
AfxTermExtensionModule