What is WINVER?

aajkaltak picture aajkaltak · Sep 17, 2009 · Viewed 28.1k times · Source

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?

Answer

Reed Copsey picture Reed Copsey · Sep 17, 2009

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.