CComApartment Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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

This class provides support for managing an appartment in a thread-pooled EXE module.

System_CAPS_ICON_important.jpg Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

class CComApartment

Public Constructors

NameDescription
CComApartment::CComApartmentThe constructor.

Public Methods

NameDescription
CComApartment::ApartmentMarks the thread's starting address.
CComApartment::GetLockCountReturns the thread's current lock count.
CComApartment::LockIncrements the thread's lock count.
CComApartment::UnlockDecrements the thread's lock count.

Public Data Members

NameDescription
CComApartment::m_dwThreadIDContains the thread's identifier.
CComApartment::m_hThreadContains the thread's handle.
CComApartment::m_nLockCntContains the thread's current lock count.

CComApartment is used by CComAutoThreadModule to manage an apartment in a thread-pooled EXE module. CComApartment provides methods for incrementing and decrementing the lock count on a thread.

Header: atlbase.h

Marks the thread's starting address.

DWORD Apartment();

Return Value

Always 0.

Remarks

Automatically set during CComAutoThreadModule::Init.

The constructor.

CComApartment();

Remarks

Initializes the CComApartment data members m_nLockCnt and m_hThread.

Returns the thread's current lock count.

LONG GetLockCount();

Return Value

The lock count on the thread.

Increments the thread's lock count.

LONG Lock();

Return Value

A value that may be useful for diagnostics or testing.

Remarks

Called by CComAutoThreadModule::Lock.

The lock count on the thread is used for statistical purposes.

Contains the thread's identifier.

DWORD m_dwThreadID;

Contains the thread's handle.

HANDLE m_hThread;

Contains the thread's current lock count.

LONG m_nLockCnt;

Decrements the thread's lock count.

LONG Unlock();

Return Value

A value that may be useful for diagnostics or testing.

Remarks

Called by CComAutoThreadModule::Unlock.

The lock count on the thread is used for statistical purposes.

Class Overview

Show: