Search code examples
c++windowsheaderheader-files

What is WINVER?


I was looking at some code and they had this line: #define WINVER 0x0501 in stdafx.h file? Why do you need to define WINVER? How does it affect your code? Can someone please explain?


Solution

  • WINVER determines the minimum platform SDK required to build your application, which in turn will determine at compile time which routines are found by the headers.

    You can use this to verify, at compile time, that your application will work on Windows 2000 (0x0500), for example, or on Windows XP (0x0501).

    MSDN's page on Modifying WINVER and _WIN32_WINNT goes into this in more detail.