Some of the DWMWINDOWATTRIBUTE
options in the Windows SDK are only available starting with certain Windows builds, for example:
DWMWA_BORDER_COLOR
This value is supported starting with Windows 11 Build 22000.
How can I check for the build version using the preprocessor? Something like:
#if WINDOWS_BUILD >= 22000
COLORREF hexCol = 0x00505050;
DwmSetWindowAttribute(GetWin32Handle(), DWMWINDOWATTRIBUTE::DWMWA_BORDER_COLOR, &hexCol, sizeof(hexCol));
#endif
I know about the WINVER
macro, but that can only be used to check the main Windows version, and not a specific build. The possible values also only appear to go up to Windows 10, so you can't even use it to check for Windows 11:
#define _WIN32_WINNT_NT4 0x0400
#define _WIN32_WINNT_WIN2K 0x0500
#define _WIN32_WINNT_WINXP 0x0501
#define _WIN32_WINNT_WS03 0x0502
#define _WIN32_WINNT_WIN6 0x0600
#define _WIN32_WINNT_VISTA 0x0600
#define _WIN32_WINNT_WS08 0x0600
#define _WIN32_WINNT_LONGHORN 0x0600
#define _WIN32_WINNT_WIN7 0x0601
#define _WIN32_WINNT_WIN8 0x0602
#define _WIN32_WINNT_WINBLUE 0x0603
#define _WIN32_WINNT_WINTHRESHOLD 0x0A00
#define _WIN32_WINNT_WIN10 0x0A00
If I can't check against the build version, is there some other way I can check whether DWMWA_BORDER_COLOR
is defined? I can't use #ifdef
, since it's an enum value and not a macro.