次の方法で共有


CComObjectNoLock Class

 

The latest version of this topic can be found at CComObjectNoLock Class.

This class implements IUnknown for a nonaggregated object, but does not increment the module lock count in the constructor.

Syntax

template<class Base>  
class CComObjectNoLock : public Base

Parameters

Base
Your class, derived from CComObjectRoot or CComObjectRootEx, as well as from any other interface you want to support on the object.

Members

Public Constructors

Name Description
CComObjectNoLock::CComObjectNoLock Constructor.
CComObjectNoLock::~CComObjectNoLock The destructor.

Public Methods

Name Description
CComObjectNoLock::AddRef Increments the reference count on the object.
CComObjectNoLock::QueryInterface Returns a pointer to the requested interface.
CComObjectNoLock::Release Decrements the reference count on the object.

Remarks

CComObjectNoLock is similar to CComObject in that it implements IUnknown for a nonaggregated object; however, CComObjectNoLock does not increment the module lock count in the constructor.

ATL uses CComObjectNoLock internally for class factories. In general, you will not use this class directly.

Inheritance Hierarchy

Base

CComObjectNoLock

Requirements

Header: atlcom.h

CComObjectNoLock::AddRef

Increments the reference count on the object.

STDMETHOD_(ULONG, AddRef)();

Return Value

A value that may be useful for diagnostics or testing.

CComObjectNoLock::CComObjectNoLock

The constructor. Unlike CComObject, does not increment the module lock count.

CComObjectNoLock(void* = NULL);

Parameters

void*
[in] This unnamed parameter is not used. It exists for symmetry with other CComXXXObjectXXX constructors.

CComObjectNoLock::~CComObjectNoLock

The destructor.

~CComObjectNoLock();

Remarks

Frees all allocated resources and calls FinalRelease.

CComObjectNoLock::QueryInterface

Retrieves a pointer to the requested interface.

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

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.

Return Value

A standard HRESULT value.

CComObjectNoLock::Release

Decrements the reference count on the object.

STDMETHOD_(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.

See Also

Class Overview