| Home | Libraries | People | FAQ | More

## Configuration

Boost.WinAPI recognizes the following configuration macros:

Table 1.1. Configuration macros

Macro name | Effect
--- | ---

`BOOST_USE_WINAPI_VERSION`

If defined, designates the target Windows API version. The version should be given as hexadecimal integer, same as the `_WIN32_WINNT` macro values. Some of the versions are given here. If the macro is not defined, the version is deduced from `_WIN32_WINNT` and `WINVER` macros, if they are defined, or the default version is chosen. The default version is currently Windows Vista/Server 2008 on compilers that support this version of SDK and Windows XP on others. The default may change in future releases.

`BOOST_USE_NTDDI_VERSION`

If defined, designates the target Windows API version down to a particular Service Pack. This macro offers a more fine grained way to define the target Windows version than `BOOST_USE_WINAPI_VERSION`. The version should be given as hexadecimal integer, same as the `NTDDI_VERSION` macro values. Some of the versions are given here. If the macro is not defined, the version is deduced from `NTDDI_VERSION` and `BOOST_USE_WINAPI_VERSION` macros, in the latter case defaulting to the latest revision of the indicated Windows version. If `BOOST_USE_NTDDI_VERSION` is defined, `BOOST_USE_WINAPI_VERSION` is also expected to be defined to a corresponding value.

`BOOST_USE_WINAPI_FAMILY` | If defined, designates the Windows API family to use. The family can be set to one of the values of the `WINAPI_FAMILY`.
`BOOST_USE_WINDOWS_H` | This macro is part of Boost.Config. If defined, Boost.WinAPI will include `<windows.h>` and any other headers from Windows SDK as needed. Otherwise Boost.WinAPI will provide its own declarations of the SDK components as needed without including SDK headers.
`BOOST_NO_ANSI_APIS` | This macro is defined by Boost.Config on platforms that do not support narrow-character versions of some APIs. Boost.WinAPI will not declare narrow-character APIs when this macro is defined.

User's code can include `<boost/winapi/config.hpp>` to define a number of macros that can be useful. Including this header is recommended in any code that involves Windows API usage.

Table 1.2. Defined configuration macros

Macro name | Effect
--- | ---
`BOOST_USE_WINAPI_VERSION`, `BOOST_USE_NTDDI_VERSION` | If not defined by user, these macros are defined by the header to the target Windows API version.

`BOOST_WINAPI_VERSION_NT4`,
`BOOST_WINAPI_VERSION_WIN2K`,
`BOOST_WINAPI_VERSION_WINXP`,
`BOOST_WINAPI_VERSION_WS03`,
`BOOST_WINAPI_VERSION_WIN6`,
`BOOST_WINAPI_VERSION_VISTA`,
`BOOST_WINAPI_VERSION_WS08`,
`BOOST_WINAPI_VERSION_LONGHORN`,
`BOOST_WINAPI_VERSION_WIN7`,
`BOOST_WINAPI_VERSION_WIN8`,
`BOOST_WINAPI_VERSION_WINBLUE`,
`BOOST_WINAPI_VERSION_WINTHRESHOLD`,
`BOOST_WINAPI_VERSION_WIN10`

These macros expand to the constants designating the particular Windows versions and can be used together with `BOOST_USE_WINAPI_VERSION` in preprocessor version checks.

`BOOST_WINAPI_IS_MINGW` | Defined if Windows SDK is provided by MinGW.
`BOOST_WINAPI_IS_MINGW_W64` | Defined if Windows SDK is provided by MinGW-w64. Note that is does not mean that the code is compiled for 64-bit Windows.
`BOOST_WINAPI_IS_CYGWIN` | Defined if Windows SDK is provided by MinGW variant from Cygwin.