We recommend using Visual Studio 2017

MFC Macros and Globals


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 MFC Macros and Globals.

The Microsoft Foundation Class Library can be divided into two major sections: (1) the MFC classes and (2) macros and globals. If a function or variable is not a member of a class, it is a global function or variable.

The MFC library and the Active Template Library (ATL) share string conversion macros. For more information, see String Conversion Macros in the ATL documentation.

The MFC macros and globals offer functionality in the following categories.

In addition, MFC provides a function called AfxEnableControlContainer that enables any OLE container developed with MFC 4.0 to fully support embedded OLE controls.

The first part of this section briefly discusses each of the previous categories and lists the globals and macros in the category, together with brief descriptions of functionality. Following this are descriptions of the global functions, global variables, and macros in the MFC library.

System_CAPS_ICON_note.jpg Note

Many global functions start with the prefix "Afx", but some, for example, the dialog data exchange (DDX) functions and many of the database functions, do not follow this convention. All global variables start with "afx" as a prefix. Macros do not start with any particular prefix, but they are written in uppercase letters.

Class Overview