ATL Macros and Global Functions

The ATL macros and global functions offer functionality in the following categories:

Aggregation and Class Factory Macros
Category Macros
COM Map Macros and Global Functions
Composite Control Macros and Global Functions
Connection Point Macros and Global Functions
Debugging and Error Reporting Macros and Global Functions
Device Context Global Functions
Event Handling Global Functions
Marshaling Global Functions
Message Map Macros
Snap-In Macros
Object Map Macros
Pixel/HIMETRIC Conversion Global Functions
Property Map Macros
Registry Macros
Service Map Macros
Stock Property Macros
String Conversion Macros
Window Class Macros
Windows Messages

Aggregation and Class Factory Macros

DECLARE_AGGREGATABLE Declares that your object can be aggregated (the default).
DECLARE_CLASSFACTORY Declares the class factory to be CComClassFactory, the ATL default class factory.
DECLARE_CLASSFACTORY_EX Declares your class factory object to be the class factory.
DECLARE_CLASSFACTORY2 Declares CComClassFactory2 to be the class factory.
DECLARE_CLASSFACTORY_AUTO_THREAD Declares CComClassFactoryAutoThread to be the class factory.
DECLARE_CLASSFACTORY_SINGLETON Declares CComClassFactorySingleton to be the class factory.
DECLARE_GET_CONTROLLING_UNKNOWN Declares a virtual GetControllingUnknown function.
DECLARE_NOT_AGGREGATABLE Declares that your object cannot be aggregated.
DECLARE_ONLY_AGGREGATABLE Declares that your object must be aggregated.
DECLARE_POLY_AGGREGATABLE Checks the value of the outer unknown and declares your object aggregatable or not aggregatable, as appropriate.
DECLARE_PROTECT_FINAL_CONSTRUCT Protects the outer object from deletion during construction of an inner object.
DECLARE_VIEW_STATUS Specifies the VIEWSTATUS flags to the container.

Category Macros

BEGIN_CATEGORY_MAP Marks the beginning of the category map.
END_CATEGORY_MAP Marks the end of the category map.
IMPLEMENTED_CATEGORY Indicates categories that are implemented by the COM object.
REQUIRED_CATEGORY Indicates categories that are required of the container by the COM object.

COM Map Macros and Global Functions

AtlInternalQueryInterface Delegates to the IUnknown of a nonaggregated object.
BEGIN_COM_MAP Marks the beginning of the COM interface map entries.
COM_INTERFACE_ENTRY Enters interfaces into the COM interface map.
END_COM_MAP Marks the end of the COM interface map entries.
InlineIsEqualIUnknown Generates efficient code for IUnknown.

Composite Control Macros and Global Functions

AtlAxDialogBox Creates a modal dialog box from a dialog template provided by the user. The dialog may contain ActiveX controls.
AtlAxCreateDialog Creates a modeless dialog box from a dialog template provided by the user. The resulting dialog box can contain ActiveX controls.
AtlAxCreateControl Creates an ActiveX control, initializes it, and hosts it in the specified window.
AtlAxCreateControlEx Creates an ActiveX control, initializes it, and hosts it in the specified window.
AtlAxAttachControl Attaches a previously created control to the specified window.
AtlAxGetHost Used to obtain a direct interface pointer to the container for a specified window (if any), given its handle.
AtlAxGetControl Used to obtain a direct interface pointer to the control contained inside a specified window (if any), given its handle.
AtlSetChildSite Initializes the IUnknown of the child site.
AtlAxWinInit Initializes the hosting code for AxWin objects.
AtlAxWinTerm Uninitializes the hosting code for AxWin objects.
AtlGetObjectSourceInterface Returns information about the default source interface of an object.
BEGIN_SINK_MAP Marks the beginning of the event sink map for the composite control.
END_SINK_MAP Marks the end of the event sink map for the composite control.
SINK_ENTRY Entry to the event sink map.
SINK_ENTRY_EX Entry to the event sink map with an additional parameter.
SINK_ENTRY_INFO Entry to the event sink map with manually supplied type information for use with IDispEventSimpleImpl.

Connection Point Macros and Global Functions

AtlAdvise Creates a connection between an object's connection point and a client's sink.
AtlUnadvise Terminates the connection established through AtlAdvise.
AtlAdviseSinkMap Advises or unadvises entries in an event sink map.
BEGIN_CONNECTION_POINT_MAP Marks the beginning of the connection point map entries.
CONNECTION_POINT_ENTRY Enters connection points into the map.
END_CONNECTION_POINT_MAP Marks the end of the connection point map entries.

Snap-In Object Macros

BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP Marks the beginning of the snap-in extension data class map for a Snap-In object.
BEGIN_SNAPINTOOLBARID_MAP Marks the beginning of the toolbar map for a Snap-In object.
END_EXTENSION_SNAPIN_NODEINFO_MAP Marks the end of the snap-in extension data class map for a Snap-In object.
END_SNAPINTOOLBARID_MAP Marks the end of the toolbar map for a Snap-In object.
EXTENSION_SNAPIN_DATACLASS Creates a data member for the data class of the snap-in extension.
EXTENSION_SNAPIN_NODEINFO_ENTRY Enters a snap-in extension data class into the snap-in extension data class map of the Snap-In object.
SNAPINMENUID Declares the ID of the context menu used by the Snap-In object.
SNAPINTOOLBARID_ENTRY Enters a toolbar into the toolbar map of the Snap-In object.

Debugging and Error Reporting Macros and Global Functions

AtlReportError Sets up IErrorInfo to provide error details to a client.
AtlTrace Global function that sends a formatted message and/or variable values to the dump device.
ATLTRACE Sends a formatted message and/or variable values to the dump device.
ATLTRACENOTIMPL Sends a message to the dump device that the specified function is not implemented.
atlTraceFlags Identifies the flags used in ATLTRACE2.
ATLTRACE2 Reports warnings to an output device, such as the debugger window, according to the indicated flags and levels.

Device Context Global Functions

AtlCreateTargetDC Creates a device context.

Event Handling Global Functions

AtlWaitWithMessageLoop Waits for an object to be signaled, meanwhile dispatching window messages as needed.

Marshaling Global Functions

AtlFreeMarshalStream Releases the marshal data and the IStream pointer.
AtlMarshalPtrInProc Creates a new stream object and marshals the specified interface pointer.
AtlUnmarshalPtr Converts a stream's marshaling data into an interface pointer.

Message Map Macros

BEGIN_MSG_MAP Marks the beginning of the default message map.
ALT_MSG_MAP Marks the beginning of an alternate message map.
DECLARE_EMPTY_MSG_MAP Implements an empty message map.
MESSAGE_HANDLER Maps a Windows message to a handler function.
MESSAGE_RANGE_HANDLER Maps a contiguous range of Windows messages to a handler function.
COMMAND_HANDLER Maps a WM_COMMAND message to a handler function, based on the notification code and the identifier of the menu item, control, or accelerator.
COMMAND_ID_HANDLER Maps a WM_COMMAND message to a handler function, based on the identifier of the menu item, control, or accelerator.
COMMAND_CODE_HANDLER Maps a WM_COMMAND message to a handler function, based on the notification code.
COMMAND_RANGE_HANDLER Maps a contiguous range of WM_COMMAND messages to a handler function.
NOTIFY_HANDLER Maps a WM_NOTIFY message to a handler function, based on the notification code and the control identifier.
NOTIFY_ID_HANDLER Maps a WM_NOTIFY message to a handler function, based on the control identifier.
NOTIFY_CODE_HANDLER Maps a WM_NOTIFY message to a handler function, based on the notification code.
NOTIFY_RANGE_HANDLER Maps a contiguous range of WM_NOTIFY messages to a handler function.
REFLECT_NOTIFICATIONS Reflects notification messages back to the window that sent them.
DEFAULT_REFLECTION_HANDLER Provides a default handler for reflected messages that are not handled otherwise.
CHAIN_MSG_MAP Chains to the default message map in the base class.
CHAIN_MSG_MAP_MEMBER Chains to the default message map in a data member of the class.
CHAIN_MSG_MAP_ALT Chains to an alternate message map in the base class.
CHAIN_MSG_MAP_ALT_MEMBER Chains to an alternate message map in a data member of the class.
CHAIN_MSG_MAP_DYNAMIC Chains to the message map in another class at run time.
END_MSG_MAP Marks the end of a message map.

Object Map Macros

BEGIN_OBJECT_MAP Marks the beginning of the ATL object map and initializes the array of object descriptions.
OBJECT_ENTRY Enters an ATL object into the object map, updates the registry, and creates an instance of the object.
OBJECT_ENTRY_NON_CREATEABLE Allows you to specify that the object should be registered and initialized, but it should not be createable via CoCreateInstance.
END_OBJECT_MAP Marks the end of the ATL object map.
DECLARE_OBJECT_DESCRIPTION Allows you to specify a class object's text description, which will be entered into the object map.

Pixel/HIMETRIC Conversion Global Functions

AtlHiMetricToPixel Converts HIMETRIC units (each unit is 0.01 millimeter) to pixels.
AtlPixelToHiMetric Converts pixels to HIMETRIC units (each unit is 0.01 millimeter).

Property Map Macros

BEGIN_PROP_MAP Marks the beginning of the ATL property map.
PROP_DATA_ENTRY Indicates the extent, or dimensions, of an ActiveX control.
PROP_ENTRY Enters a property description, property DISPID, and property page CLSID into the property map.
PROP_ENTRY_EX Enters a property description, property DISPID, property page CLSID, and IDispatch IID into the property map.
PROP_PAGE Enters a property page CLSID into the property map.
END_PROP_MAP Marks the end of the ATL property map.

Registry Macros

DECLARE_NO_REGISTRY Avoids default ATL registration.
DECLARE_REGISTRY Enters or removes the main object's entry in the system registry.
DECLARE_REGISTRY_RESOURCE Finds the named resource and runs the registry script within it.
DECLARE_REGISTRY_RESOURCEID Finds the resource identified by an ID number and runs the registry script within it.

Service Map Macros

BEGIN_SERVICE_MAP Marks the beginning of an ATL service map.
END_SERVICE_MAP Marks the end of an ATL service map.
SERVICE_ENTRY Indicates that the object supports a specific service ID.
SERVICE_ENTRY_CHAIN Instructs IServiceProviderImpl::QueryService to chain to the specified object.

Stock Property Macros

IMPLEMENT_BOOL_STOCKPROP Implements a boolean stock property for an ATL object.
IMPLEMENT_BSTR_STOCKPROP Implements a text stock property for an ATL object.
IMPLEMENT_STOCKPROP Implements a stock property for an ATL object.

String Conversion Macros

String Conversion Macros Set of macros that convert between string types.
DEVMODE and TEXTMETRIC String Conversion Macros Set of macros that convert the strings within DEVMODE and TEXTMETRIC structures.

Window Class Macros

DECLARE_WND_CLASS Allows you to specify the name of a new window class.
DECLARE_WND_SUPERCLASS Allows you to specify the name of an existing window class on which a new window class will be based.
DECLARE_WND_CLASS_EX Allows you to specify the parameters of a class.

Window Class Macros

WM_FORWARDMSG Use to forward a message received by a window to another window for processing.