For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
This class implements the IUnknown interface for an aggregated object. By definition, an aggregated object is contained within an outer object. The
CComAggObject class is similar to the CComObject Class, except that it exposes an interface that is directly accessible to external clients.
template<class contained> class CComAggObject : public IUnknown, public CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>
|CComAggObject::AddRef||Increments the reference count on the aggregated object.|
|CComAggObject::CreateInstance||This static function allows you to create a new CComAggObject< |
|CComAggObject::FinalConstruct||Performs final initialization of |
|CComAggObject::FinalRelease||Performs final destruction of |
|CComAggObject::QueryInterface||Retrieves a pointer to the requested interface.|
|CComAggObject::Release||Decrements the reference count on the aggregated object.|
CComAggObject implements IUnknown for an aggregated object.
CComAggObject has its own IUnknown interface, separate from the outer object's IUnknown interface, and maintains its own reference count.
For more information about aggregation, see the article Fundamentals of ATL COM Objects.
Increments the reference count on the aggregated object.
A value that may be useful for diagnostics or testing.
[in] The outer unknown.
CComContainedObject member, m_contained, and increments the module lock count.
The destructor decrements the module lock count.
Frees all allocated resources, calls FinalRelease, and decrements the module lock count.
This static function allows you to create a new CComAggObject<
contained > object without the overhead of CoCreateInstance.
static HRESULT WINAPI CreateInstance( LPUNKNOWN pUnkOuter, CComAggObject<contained>** pp);
[out] A pointer to a CComAggObject<contained > pointer. If
CreateInstance is unsuccessful,
pp is set to NULL.
The object returned has a reference count of zero, so call
AddRef immediately, then use Release to free the reference on the object pointer when you're done.
If you do not need direct access to the object, but still want to create a new object without the overhead of
CoCreateInstance, use CComCoClass::CreateInstance instead.
Called during the final stages of object construction, this method performs any final initialization on the m_contained member.
Called during object destruction, this method frees the m_contained member.
A CComContainedObject object derived from your class.
All IUnknown calls through
m_contained are delegated to the outer unknown.
Retrieves a pointer to the requested interface.
STDMETHOD(QueryInterface)(REFIID iid, void** ppvObject); template <class Q> HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp);
[in] The identifier of the interface being requested.
[out] A pointer to the interface pointer identified by
iid. If the object does not support this interface,
ppvObject is set to NULL.
[out] A pointer to the interface pointer identified by type
Q. If the object does not support this interface,
pp is set to NULL.
If the requested interface is IUnknown,
QueryInterface returns a pointer to the aggregated object's own IUnknown and increments the reference count. Otherwise, this method queries for the interface through the
CComContainedObject member, m_contained.
Decrements the reference count on the aggregated object.
In debug builds, Release returns a value that may be useful for diagnostics or testing. In non-debug builds, Release always returns 0.