OOPortal OOPortal


ATL Development   «Prev 

Inside object maps

The ATL COM AppWizard created an empty object map in file PhBook.cpp, our server implementation file--when we generated our project:
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

Adding class CPhBookObj to implement COM object PhBookObj added an object entry to the map:
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_PhBookObj, CPhBookObj)
END_OBJECT_MAP()

These macros generate a global array of structures of type _ATL_OBJMAP_ENTRY called ObjectMap. Each COM object implemented within the server plugs into the ATL framework via an _ATL_OBJMAP_ENTRY structure placed in the object map.
The _ATL_OBJMAP_ENTRY structure is used by the ATL framework code to create and access an object's class factory, create an instance of the C++ class (i.e., create an instance of the COM object), and get an object's CLSID.