แก้ไข

แชร์ผ่าน


ATL Typedefs

The Active Template Library includes the following typedefs.

Typedef Description
_ATL_BASE_MODULE Defined as a typedef based on _ATL_BASE_MODULE70.
_ATL_COM_MODULE Defined as a typedef based on _ATL_COM_MODULE70.
_ATL_MODULE Defined as a typedef based on _ATL_MODULE70.
_ATL_WIN_MODULE Defined as a typedef based on _ATL_WIN_MODULE70
ATL_URL_PORT The type used by CUrl for specifying a port number.
CComDispatchDriver This class manages COM interface pointers.
CComGlobalsThreadModel Calls the appropriate thread model methods, regardless of the threading model being used.
CComObjectThreadModel Calls the appropriate thread model methods, regardless of the threading model being used.
CContainedWindow This class is a specialization of CContainedWindowT.
CPath A specialization of CPathT using CString.
CPathA A specialization of CPathT using CStringA.
CPathW A specialization of CPathT using CStringW.
CSimpleValArray Represents an array for storing simple types.
DefaultThreadTraits The default thread traits class.
LPCURL A pointer to a constant CUrl object.
LPURL A pointer to a CUrl object.

_ATL_BASE_MODULE

Defined as a typedef based on _ATL_BASE_MODULE70.

typedef ATL::_ATL_BASE_MODULE70 _ATL_BASE_MODULE;

Remarks

Used in every ATL project. Based on _ATL_BASE_MODULE70.

Classes that are part of the ATL 7.0 Module Classes derive from the _ATL_BASE_MODULE structure. For more information on ATL Module Classes, refer to COM Modules Classes.

Requirements

Header: atlcore.h

_ATL_COM_MODULE

Defined as a typedef based on _ATL_COM_MODULE70.

typedef ATL::_ATL_COM_MODULE70 _ATL_COM_MODULE;

Remarks

Used by ATL projects which use COM features. Based on _ATL_COM_MODULE70.

Requirements

Header: atlbase.h

_ATL_MODULE

Defined as a typedef based on _ATL_MODULE70.

typedef ATL::_ATL_MODULE70 _ATL_MODULE;

Requirements

Header:

Remarks

Based on _ATL_MODULE70.

_ATL_WIN_MODULE

Defined as a typedef based on _ATL_WIN_MODULE70.

typedef ATL::_ATL_WIN_MODULE70 _ATL_WIN_MODULE;

Remarks

Used by any ATL projects which use windowing features. Based on _ATL_WIN_MODULE70.

Requirements

Header: atlbase.h

ATL_URL_PORT

The type used by CUrl for specifying a port number.

typedef WORD ATL_URL_PORT;

Requirements

Header: atlutil.h

CComDispatchDriver

This class manages COM interface pointers.

typedef CComQIPtr<IDispatch, &__uuidof(IDispatch)> CComDispatchDriver;

Requirements

Header: atlbase.h

CComGlobalsThreadModel

Calls the appropriate thread model methods, regardless of the threading model being used.

#if defined(_ATL_SINGLE_THREADED)
typedef CComSingleThreadModel CComGlobalsThreadModel;
#elif defined(_ATL_APARTMENT_THREADED)
typedef CComMultiThreadModel CComGlobalsThreadModel;
#elif defined(_ATL_FREE_THREADED)
typedef CComMultiThreadModel CComGlobalsThreadModel;
#else
#pragma message ("No global threading model defined")
#endif

Remarks

Depending on the threading model used by your application, the typedef name CComGlobalsThreadModel references either CComSingleThreadModel or CComMultiThreadModel. These classes provide additional typedef names to reference a critical section class.

Note

CComGlobalsThreadModel does not reference class CComMultiThreadModelNoCS.

Using CComGlobalsThreadModel frees you from specifying a particular threading model class. Regardless of the threading model being used, the appropriate methods will be called.

In addition to CComGlobalsThreadModel, ATL provides the typedef name CComObjectThreadModel. The class referenced by each typedef depends on the threading model used, as shown in the following table:

typedef Single threading Apartment threading Free threading
CComObjectThreadModel S S M
CComGlobalsThreadModel S M M

S= CComSingleThreadModel; M= CComMultiThreadModel

Use CComObjectThreadModel within a single object class. Use CComGlobalsThreadModel in an object that is globally available to your program, or when you want to protect module resources across multiple threads.

Requirements

Header: atlbase.h

CComObjectThreadModel

Calls the appropriate thread model methods, regardless of the threading model being used.

#if defined(_ATL_SINGLE_THREADED)
typedef CComSingleThreadModel CComObjectThreadModel;
#elif defined(_ATL_APARTMENT_THREADED)
typedef CComSingleThreadModel CComObjectThreadModel;
#elif defined(_ATL_FREE_THREADED)
typedef CComMultiThreadModel CComObjectThreadModel;
#else
#pragma message ("No global threading model defined")
#endif

Remarks

Depending on the threading model used by your application, the typedef name CComObjectThreadModel references either CComSingleThreadModel or CComMultiThreadModel. These classes provide additional typedef names to reference a critical section class.

Note

CComObjectThreadModel does not reference class CComMultiThreadModelNoCS.

Using CComObjectThreadModel frees you from specifying a particular threading model class. Regardless of the threading model being used, the appropriate methods will be called.

In addition to CComObjectThreadModel, ATL provides the typedef name CComGlobalsThreadModel. The class referenced by each typedef depends on the threading model used, as shown in the following table:

typedef Single threading Apartment threading Free threading
CComObjectThreadModel S S M
CComGlobalsThreadModel S M M

S= CComSingleThreadModel; M= CComMultiThreadModel

Use CComObjectThreadModel within a single object class. Use CComGlobalsThreadModel in an object that is either globally available to your program, or when you want to protect module resources across multiple threads.

Requirements

Header: atlbase.h

CContainedWindow

This class is a specialization of CContainedWindowT.

typedef CContainedWindowT<CWindow> CContainedWindow;

Requirements

Header: atlwin.h

Remarks

CContainedWindow is a specialization of CContainedWindowT. If you want to change the base class or traits, use CContainedWindowT directly.

CPath

A specialization of CPathT using CString.

typedef CPathT<CString> CPath;

Requirements

Header: atlpath.h

CPathA

A specialization of CPathT using CStringA.

typedef CPathT<CStringA> CPathA;

Requirements

Header: atlpath.h

CPathW

A specialization of CPathT using CStringW.

typedef ATL::CPathT<CStringW> CPathW;

Requirements

Header: atlpath.h

CSimpleValArray

Represents an array for storing simple types.

#define CSimpleValArray CSimpleArray

Remarks

CSimpleValArray is provided for creating and managing arrays containing simple data types. It is a simple #define of CSimpleArray.

Requirements

Header: atlsimpcoll.h

LPCURL

A pointer to a constant CUrl object.

typedef const CUrl* LPCURL;

Requirements

Header: atlutil.h

DefaultThreadTraits

The default thread traits class.

Syntax

#if defined(_MT)
   typedef CRTThreadTraits DefaultThreadTraits;
#else
   typedef Win32ThreadTraits DefaultThreadTraits;
#endif

Remarks

If the current project uses the multithreaded CRT, DefaultThreadTraits is defined as CRTThreadTraits. Otherwise, Win32ThreadTraits is used.

Requirements

Header: atlbase.h

LPURL

A pointer to a CUrl object.

typedef CUrl* LPURL;

Requirements

Header: atlutil.h

See also

ATL COM Desktop Components
Functions
Global Variables
Classes and structs
Macros