CComContainedObject

template< class Base >
class CComContainedObject : public Base

Parameters

Base Your class, derived from CComObjectRoot or CComObjectRootEx.

ATL uses CComContainedObject in classes CComAggObject, CComPolyObject, and CComCachedTearOffObject. CComContainedObject implements IUnknown by delegating to the owner object's IUnknown. (The owner is either the outer object of an aggregation, or the object for which a tear-off interface is being created.) CComContainedObject calls CComObjectRootEx's OuterQueryInterface, OuterAddRef, and OuterRelease, all inherited through Base.

#include <atlcom.h>


CComContainedObject Class Members

Class Methods
CComContainedObjectConstructor. Initializes the member pointer to the owner object's IUnknown.
GetControllingUnknownRetrieves the owner object's IUnknown.
IUnknown Methods
AddRefIncrements the reference count on the owner object.
QueryInterfaceRetrieves a pointer to the interface requested on the owner object.
ReleaseDecrements the reference count on the owner object.

CComContainedObject Overview


Methods


CComContainedObject::AddRef

ULONG AddRef( );

Return Value

A value that may be useful for diagnostics or testing.

Remarks

Increments the reference count on the owner object.

CComContainedObject Overview | Class Members

See Also CComContainedObject::Release


CComContainedObject::CComContainedObject

CComContainedObject( void* pv );

Parameters

pv [in] The owner object's IUnknown.

Remarks

The constructor. Sets the m_pOuterUnknown member pointer (inherited through the Base class) to pv.

CComContainedObject Overview | Class Members

See Also CComObjectRootEx::m_pOuterUnknown


CComContainedObject::GetControllingUnknown

IUnknown* GetControllingUnknown( );

Return Value

The owner object's IUnknown.

Remarks

Returns the m_pOuterUnknown member pointer (inherited through the Base class) which holds the owner object's IUnknown. This method may be virtual if Base has declared the DECLARE_GET_CONTROLLING_UNKNOWN macro.

CComContainedObject Overview | Class Members

See Also CComObjectRootEx::m_pOuterUnknown


CComContainedObject::QueryInterface

HRESULT QueryInterface( REFIID iid, void** ppvObject );

Return Value

A standard HRESULT value.

Parameters

iid [in] The identifier of the interface being requested.

ppvObject [out] A pointer to the interface pointer identified by iid. If the object does not support this interface, ppvObject is set to NULL.

Remarks

Retrieves a pointer to the interface requested on the owner object.

CComContainedObject Overview | Class Members


CComContainedObject::Release

ULONG Release( );

Return Value

In debug builds, Release returns a value that may be useful for diagnostics or testing. In non-debug builds, Release always returns 0.

Remarks

Decrements the reference count on the owner object.

CComContainedObject Overview | Class Members

See Also CComContainedObject::AddRef