Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 2.75 KB

afx-extension-module-structure.md

File metadata and controls

73 lines (56 loc) · 2.75 KB
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
cpp-windows
article
AFX_EXTENSION_MODULE
C++
AFX_EXTENSION_MODULE structure [MFC]
b85a989c-d0c5-4b28-b53c-dad45b75704e
11
mikeblome
mblome
ghogen

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