Muokkaa

Jaa


CAtlComModule Class

This class implements a COM server module.

Syntax

class CAtlComModule : public _ATL_COM_MODULE

Members

Public Constructors

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

Public Methods

Name Description
CAtlComModule::RegisterServer Call this method to update the system registry for each object in the object map.
CAtlComModule::RegisterTypeLib Call this method to register a type library.
CAtlComModule::UnregisterServer Call this method to unregister each object in the object map.
CAtlComModule::UnRegisterTypeLib Call this method to unregister a type library.

Remarks

CAtlComModule implements a COM server module, allowing a client to access the module's components.

This class replaces the obsolete CComModule class used in earlier versions of ATL. See ATL Module Classes for more details.

Inheritance Hierarchy

_ATL_COM_MODULE

CAtlComModule

Requirements

Header: atlbase.h

CAtlComModule::CAtlComModule

The constructor.

CAtlComModule() throw();

Remarks

Initializes the module.

CAtlComModule::~CAtlComModule

The destructor.

~CAtlComModule();

Remarks

Frees all class factories.

CAtlComModule::RegisterServer

Call this method to update the system registry for each object in the object map.

HRESULT RegisterServer(BOOL bRegTypeLib = FALSE, const CLSID* pCLSID = NULL);

Parameters

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

pCLSID
Points to the CLSID of the object to be registered. If NULL (the default value), all objects in the object map will be registered.

Return Value

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

Remarks

Calls the global function AtlComModuleRegisterServer.

CAtlComModule::RegisterTypeLib

Call this method to register a type library.

HRESULT RegisterTypeLib(LPCTSTR lpszIndex);
HRESULT RegisterTypeLib();

Parameters

lpszIndex
String in the format "\\N", where N is the integer index of the TYPELIB resource.

Return Value

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

Remarks

Adds information about a type library to the system registry. If the module instance contains multiple type libraries, use the first version of this method to specify which type library should be used.

CAtlComModule::UnregisterServer

Call this method to unregister each object in the object map.

HRESULT UnregisterServer(
    BOOL bRegTypeLib = FALSE,
    const CLSID* pCLSID = NULL);

Parameters

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

pCLSID
Points to the CLSID of the object to be unregistered. If NULL (the default value), all objects in the object map will be unregistered.

Return Value

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

Remarks

Calls the global function AtlComModuleUnregisterServer.

CAtlComModule::UnRegisterTypeLib

Call this method to unregister a type library.

HRESULT UnRegisterTypeLib(LPCTSTR lpszIndex);
HRESULT UnRegisterTypeLib();

Parameters

lpszIndex
String in the format "\\N", where N is the integer index of the TYPELIB resource.

Remarks

Removes information about a type library from the system registry. If the module instance contains multiple type libraries, use the first version of this method to specify which type library should be used.

Return Value

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

See also

_ATL_COM_MODULE
Class Overview