Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 2.49 KB

afx-extension-module-structure.md

File metadata and controls

67 lines (46 loc) · 2.49 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: AFX_EXTENSION_MODULE Structure
AFX_EXTENSION_MODULE Structure
11/04/2016
AFX_EXTENSION_MODULE
AFX_EXTENSION_MODULE structure [MFC]
b85a989c-d0c5-4b28-b53c-dad45b75704e

AFX_EXTENSION_MODULE Structure

The AFX_EXTENSION_MODULE is used during initialization of MFC extension DLLs to hold the state of MFC extension DLL module.

Syntax

struct AFX_EXTENSION_MODULE
{
    BOOL bInitialized;
    HMODULE hModule;
    HMODULE hResource;
    CRuntimeClass* pFirstSharedClass;
    COleObjectFactory* pFirstSharedFactory;
};

Parameters

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.

Remarks

MFC extension DLLs need to do two things in their DllMain function:

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]

Requirements

Header: afx.h

See also

Structures, Styles, Callbacks, and Message Maps
AfxInitExtensionModule
AfxTermExtensionModule