COM Map Macros

These macros define COM interface maps.

Macro Description
BEGIN_COM_MAP Marks the beginning of the COM interface map entries.
END_COM_MAP Marks the end of the COM interface map entries.

Requirements

Header: atlcom.h

BEGIN_COM_MAP

The COM map is the mechanism that exposes interfaces on an object to a client through QueryInterface.

BEGIN_COM_MAP(x)

Parameters

x
[in] The name of the class object you are exposing interfaces on.

Remarks

CComObjectRootEx::InternalQueryInterface only returns pointers for interfaces in the COM map. Start your interface map with the BEGIN_COM_MAP macro, add entries for each of your interfaces with the COM_INTERFACE_ENTRY macro or one of its variants, and complete the map with the END_COM_MAP macro.

Example

From the ATL BEEPER sample:

BEGIN_COM_MAP(CBeeper)
   COM_INTERFACE_ENTRY(IBeeper)
   COM_INTERFACE_ENTRY(IDispatch)
   COM_INTERFACE_ENTRY_TEAR_OFF(IID_ISupportErrorInfo, CBeeper2)
END_COM_MAP()

END_COM_MAP

Ends the definition of your COM interface map.

END_COM_MAP()

See also

Macros
COM Map Global Functions