แก้ไข

แชร์ผ่าน


Server Registration Global Functions

These functions provide support for registering and unregistering server objects in the object map.

Important

The functions listed in the following table cannot be used in applications that execute in the Windows Runtime.

Name Description
AtlComModuleRegisterServer This function is called to register every object in the object map.
AtlComModuleUnregisterServer This function is called to unregister every object in the object map.
AtlComModuleRegisterClassObjects This function is called to register class objects.
AtlComModuleRevokeClassObjects This function is called to revoke class objects from a COM module.
AtlComModuleGetClassObject This function is called to get the class object.

Requirements

Header: atlbase.h

AtlComModuleRegisterServer

This function is called to register every object in the object map.

ATLINLINE ATLAPI AtlComModuleRegisterServer(
    _ATL_COM_MODULE* pComModule,
    BOOL bRegTypeLib,
    const CLSID* pCLSID);

Parameters

pComModule
Pointer to the COM module.

bRegTypeLib
TRUE if the type library is to be registered.

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

Return Value

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

Remarks

AtlComModuleRegisterServer walks the ATL autogenerated object map and registers each object in the map. If pCLSID is not NULL, then only the object referred to by pCLSID is registered; otherwise all of the objects are registered.

This function is called by CAtlComModule::RegisterServer.

AtlComModuleUnregisterServer

This function is called to unregister every object in the object map.

ATLINLINE ATLAPI AtlComModuleUnregisterServer(
    _ATL_COM_MODULE* pComModule,
    BOOL bUnRegTypeLib,
    const CLSID* pCLSID);

Parameters

pComModule
Pointer to the COM module.

bUnRegTypeLib
TRUE if the type library is to be registered.

pCLSID
Points to the CLSID of the object to be unregistered. If NULL all objects in the object map will be unregistered.

Return Value

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

Remarks

AtlComModuleUnregisterServer walks the ATL object map and unregisters each object in the map. If pCLSID is not NULL, then only the object referred to by pCLSID is unregistered; otherwise all of the objects are unregistered.

This function is called by CAtlComModule::UnregisterServer.

AtlComModuleRegisterClassObjects

This function is called to register class objects.

ATLINLINE ATLAPI AtlComModuleRegisterClassObjects(
    _ATL_COM_MODULE* pComModule,
    DWORD dwClsContext,
    DWORD dwFlags);

Parameters

pComModule
Pointer to the COM module.

dwClsContext
Specifies the context in which the class object is to be run. Possible values are CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, or CLSCTX_LOCAL_SERVER. See CLSCTX for more details.

dwFlags
Determines the connection types to the class object. Possible values are REGCLS_SINGLEUSE, REGCLS_MULTIPLEUSE, or REGCLS_MULTI_SEPARATE. See REGCLS for more details.

Return Value

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

Remarks

This helper function is utilized by CComModule::RegisterClassObjects (obsolete in ATL 7.0) and CAtlExeModuleT::RegisterClassObjects.

AtlComModuleRevokeClassObjects

This function is called to remove the class factory/factories from the Running Object Table.

ATLINLINE ATLAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE* pComModule);

Parameters

pComModule
Pointer to the COM module.

Return Value

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

Remarks

This helper function is utilized by CComModule::RevokeClassObjects (obsolete in ATL 7.0) and CAtlExeModuleT::RevokeClassObjects.

AtlComModuleGetClassObject

This function is called to return the class factory.

ATLINLINE ATLAPI AtlComModuleGetClassObject(
    _ATL_COM_MODULE* pComModule,
    REFCLSID rclsid,
    REFIID riid,
    LPVOID* ppv);

Parameters

pComModule
Pointer to the COM module.

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 helper function is utilized by CComModule::GetClassObject (obsolete in ATL 7.0) and CAtlDllModuleT::GetClassObject.

See also

Functions