This sample shows how different COM interface map entry macros are used. The text on the buttons below indicates the type of the map entry used to expose each interface on the 'outer' object. When a button is pressed, the GetName() method on the outer object is called. This method QueryInterfaces the controlling unknown for the interface exposed using the particular type of map entry you chose. GetName() retrieves the Name property on that interface. The Name property contains the name of the interface. This is then displayed on the button you pushed.


This macro is the one you typically use most. It's job is to expose an interface that you have multiply-inherited into your object.


This macro exposes a tear-off interface. Tear-off interfaces are implemented using a seperate class. They are typically used for interfaces that are rarely used.


Similar to a tear-off. Regular tear-off interfaces are created on every QueryInterface for that IID. With a cached tear-off, the class implementing the tear-off will be instantiated the first time the interface is requested. Subsequent requests for that interface will then reuse the already instantiated instance.


Causes the COM_MAP to chain to another COM_MAP. You can imagine the other COM_MAP inserted at the position you use this macro.


exposes an interface from an object that you are aggregating on. The pUnk is the inner unknown of the aggregate.


This is used to implement delayed aggregation, which means that ATL will automatically create and aggregate on the inner object when someone QIs for this interface. This only happens if the aggregate hasn't already been created, ie when pUnk != NULL


This blindly exposes all the interfaces on an aggregate.


Combines delayed (AUTOAGGREGATE) and blind (AUTOAGGREGATE_BLIND) aggregation.



Best experienced with
Microsoft Internet Explorer