CComObjectStack Class
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CComObjectStack Class

This class creates a temporary COM object and provides it with a skeletal implementation of IUnknown.

   class Base 
class CComObjectStack :
   public Base


Your class, derived from CComObjectRoot or CComObjectRootEx, as well as from any other interface you want to support on the object.


CComObjectStack is used to create a temporary COM object and provide the object a skeletal implementation of IUnknown. Typically, the object is used as a local variable within one function (that is, pushed onto the stack). Since the object is destroyed when the function finishes, reference counting is not performed to increase efficiency.

The following example shows how to create a COM object used inside a function:

void MyFunc( )
   CComObjectStack<CMyObject> Tempobj;

The temporary object Tempobj is pushed onto the stack and automatically disappears when the function finishes.


Header: atlcom.h

See Also

Class Members | CComAggObject | CComObject | CComObjectGlobal | ATL Class Overview

© 2015 Microsoft