template< class Base >
class CComObject : public Base
Parameters
Base Your class, derived from CComObjectRoot or CComObjectRootEx, as well as from any other interfaces you want to support on the object.
CComObject implements IUnknown for a non-aggregated object. However, calls to QueryInterface, AddRef, and Release are delegated to CComObjectRootEx.
For more information about CComObject, see the article Fundamentals of ATL COM Objects.
#include <atlcom.h>
See Also CComAggObject, CComPolyObject, DECLARE_AGGREGATABLE, DECLARE_NOT_AGGREGATABLE
Methods | |
CComObject | Constructor. |
CreateInstance | Creates a new CComObject object. |
IUnknown Methods | |
AddRef | Increments the reference count on the object. |
QueryInterface | Retrieves a pointer to the requested interface. |
Release | Decrements the reference count on the object. |
ULONG AddRef( );
Return Value
A value that may be useful for diagnostics or testing.
Remarks
Increments the reference count on the object.
CComObject Overview | Class Members
See Also CComObject::Release
CComObject( void* = NULL );
Parameters
void* [in] This unnamed parameter is not used. It exists for symmetry with other CComXXXObjectXXX constructors.
Remarks
The constructor increments the module lock count. The destructor decrements it.
CComObject Overview | Class Members
static HRESULT CreateInstance( CComObject< Base >** pp );
Return Value
A standard HRESULT value.
Parameters
pp [out] A pointer to a CComObject<Base> pointer. If CreateInstance is unsuccessful, pp is set to NULL.
Remarks
This static method allows you to create a new CComObject<Base> object, without the overhead of CoCreateInstance.
CComObject Overview | Class Members
See Also CoCreateInstance in the Win32 SDK
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 requested interface.
CComObject 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 object.
CComObject Overview | Class Members
See Also CComObject::AddRef