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>
Class Methods | |
CComContainedObject | Constructor. Initializes the member pointer to the owner object's IUnknown. |
GetControllingUnknown | Retrieves the owner object's IUnknown. |
IUnknown Methods | |
AddRef | Increments the reference count on the owner object. |
QueryInterface | Retrieves a pointer to the interface requested on the owner object. |
Release | Decrements the reference count on the owner object. |
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( 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
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
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
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