Share via


CComObjectStack Class

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

template< 
   class Base  
> 
class CComObjectStack : 
   public Base

Parameters

Members

Public Constructors

Name

Description

CComObjectStack::CComObjectStack

The constructor.

CComObjectStack::~CComObjectStack

The destructor.

Public Methods

Name

Description

CComObjectStack::AddRef

Returns zero. In debug mode, calls _ASSERTE.

CComObjectStack::QueryInterface

Returns E_NOINTERFACE. In debug mode, calls _ASSERTE.

CComObjectStack::Release

Returns zero. In debug mode, calls _ASSERTE. ~

Public Data Members

Name

Description

CComObjectStack::m_hResFinalConstruct

Contains the HRESULT returned during construction of the CComObjectStack object.

Remarks

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<CMyClass2> Tempobj;
   //...
}

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

Inheritance Hierarchy

Base

CComObjectStack

Requirements

Header: atlcom.h

See Also

Reference

CComAggObject Class

CComObject Class

CComObjectGlobal Class

Other Resources

ATL Class Overview