BEGIN_OBJECT_MAP

The BEGIN_OBJECT_MAP macro is obsolete. It is provided for backward compatibility. See OBJECT_ENTRY_AUTO for the current functionality.

Marks the beginning of the object map that provides support for the registration, initialization, and creation of instances of ATL COM classes.

BEGIN_OBJECT_MAP( x )

Parameters

  • x
    [in] The name used for an array of object map entries.

Remarks

The parameter x is the name of an array holding _ATL_OBJMAP_ENTRY structures. Each element of the array describes a COM class and its corresponding C++ implementation in terms of:

  • The CLSID of the COM class

  • COM registration code for the class

  • Class factory creation code

  • Instance creation code

  • Component category registration code

  • Class-level initialization and cleanup code

Start your object map with the BEGIN_OBJECT_MAP macro, add entries for each class with the OBJECT_ENTRY macro, and complete the map with the END_OBJECT_MAP macro. Typically, wizards create the object map and add the appropriate entries automatically, but you may occasionally need to modify this code by hand.

The object map needs to be passed to CComModule::Init to enable the module's registration, initialization, and creation code to hook into the information provided.

Example

The example below, taken from the CIRCCOLL sample, shows a simple object map and the call to CComModule::Init from a DLL server:

BEGIN_OBJECT_MAP(ObjectMap)
   OBJECT_ENTRY(CLSID_MyCircleCollectionCreator, CMyCircleCollectionCreator)
END_OBJECT_MAP( )

//DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
   if (dwReason == DLL_PROCESS_ATTACH)
   {
      _Module.Init(ObjectMap, hInstance);
      DisableThreadLibraryCalls(hInstance);
   }
   else if (dwReason == DLL_PROCESS_DETACH)
      _Module.Term();
   return TRUE;
}

Requirements

Header: atlcom.h

See Also

Reference

Obsolete ATL Topics