Creating an Aggregate

To create an aggregate

  1. Add an IUnknown pointer to your class object and initialize it to NULL in the constructor.

  2. Override FinalConstruct to create the aggregate.

  3. Use the IUnknown pointer, defined in Step 1, as the second parameter for the COM_INTERFACE_ENTRY_AGGREGATE macros.

  4. Override FinalRelease to release the IUnknown pointer.

Note   If you use and release an interface from the aggregate during FinalConstruct, you should add the DECLARE_PROTECT_FINAL_CONSTRUCT macro to the definition of your class object.