共用方式為


CAtlDllModuleT Class

 

The latest version of this topic can be found at CAtlDllModuleT Class.

This class represents the module for a DLL.

Syntax

template <class T>  
class ATL_NO_VTABLE CAtlDllModuleT : public CAtlModuleT<T>

Parameters

T
Your class derived from CAtlDllModuleT.

Members

Public Constructors

Name Description
CAtlDllModuleT::CAtlDllModuleT The constructor.
CAtlDllModuleT::~CAtlDllModuleT The destructor.

Public Methods

Name Description
CAtlDllModuleT::DllCanUnloadNow Tests if the DLL can be unloaded.
CAtlDllModuleT::DllGetClassObject Returns a class factory.
CAtlDllModuleT::DllMain The optional entry point into a dynamic-link library (DLL).
CAtlDllModuleT::DllRegisterServer Adds entries to the system registry for objects in the DLL.
CAtlDllModuleT::DllUnregisterServer Removes entries in the system registry for objects in the DLL.
CAtlDllModuleT::GetClassObject Returns a class factory. Invoked by DllGetClassObject.

Remarks

CAtlDllModuleT represents the module for a dynamic-link library (DLL) and provides functions used by all DLL projects. This specialization of CAtlModuleT class includes support for registration.

For more information on modules in ATL, see ATL Module Classes.

Inheritance Hierarchy

_ATL_MODULE

CAtlModule

CAtlModuleT

CAtlDllModuleT

Requirements

Header: atlbase.h

CAtlDllModuleT::CAtlDllModuleT

The constructor.

CAtlDllModuleT() throw();

CAtlDllModuleT::~CAtlDllModuleT

The destructor.

~CAtlDllModuleT() throw();

CAtlDllModuleT::DllCanUnloadNow

Tests if the DLL can be unloaded.

HRESULT DllCanUnloadNow() throw();

Return Value

Returns S_OK if the DLL can be unloaded, or S_FALSE if it cannot.

CAtlDllModuleT::DllGetClassObject

Returns the class factory.

HRESULT DllGetClassObject(
    REFCLSID rclsid,
    REFIID riid,
    LPVOID* ppv) throw();

Parameters

rclsid
The CLSID of the object to be created.

riid
The IID of the requested interface.

ppv
A pointer to the interface pointer identified by riid. If the object does not support this interface, ppv is set to NULL.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

CAtlDllModuleT::DllMain

The optional entry point into a dynamic-link library (DLL).

BOOL WINAPI DllMain(DWORD dwReason, LPVOID /* lpReserved*/) throw();

Parameters

dwReason
If set to DLL_PROCESS_ATTACH, the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls are disabled.

lpReserved
Reserved.

Return Value

Always returns TRUE.

Remarks

Disabling the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls can be a useful optimization for multithreaded applications that have many DLLs, that frequently create and delete threads, and whose DLLs do not need these thread-level notifications of attachment/detachment.

CAtlDllModuleT::DllRegisterServer

Adds entries to the system registry for objects in the DLL.

HRESULT DllRegisterServer(BOOL bRegTypeLib = TRUE) throw();

Parameters

bRegTypeLib
TRUE if the type library is to be registered. The default value is TRUE.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

CAtlDllModuleT::DllUnregisterServer

Removes entries in the system registry for objects in the DLL.

HRESULT DllUnregisterServer(BOOL bUnRegTypeLib = TRUE) throw();

Parameters

bUnRegTypeLib
TRUE if the type library is to be removed from the registry. The default value is TRUE.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

CAtlDllModuleT::GetClassObject

Creates an object of the specified CLSID.

HRESULT GetClassObject(
    REFCLSID rclsid,
    REFIID riid,
    LPVOID* ppv) throw();

Parameters

rclsid
The CLSID of the object to be created.

riid
The IID of the requested interface.

ppv
A pointer to the interface pointer identified by riid. If the object does not support this interface, ppv is set to NULL.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

This method is called by CAtlDllModuleT::DllGetClassObject and is included for backward compatibility.

See Also

CAtlModuleT Class
CAtlExeModuleT Class
Class Overview
Module Classes