简体   繁体   English

什么是WINVER?

[英]What is WINVER?

I was looking at some code and they had this line: #define WINVER 0x0501 in stdafx.h file? 我正在查看一些代码,他们有这一行: stdafx.h文件中的#define WINVER 0x0501 Why do you need to define WINVER ? 为什么需要定义WINVER How does it affect your code? 它如何影响您的代码? Can someone please explain? 有人可以解释一下吗?

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. WINVER确定构建应用程序所需的最小平台SDK,这反过来将在编译时确定标题找到哪些例程。

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). 您可以使用它来在编译时验证您的应用程序是否可以在Windows 2000(0x0500)上运行,或者在Windows XP(0x0501)上运行。

MSDN's page on Modifying WINVER and _WIN32_WINNT goes into this in more detail. 有关修改WINVER和_WIN32_WINNT的 MSDN页面更详细地介绍了这一点。

WINVER defines the minimum Windows system the program can run on. WINVER定义了程序可以运行的最小Windows系统。 There's a more detailed explanation at MSDN . 在MSDN上有更详细的解释。 What #define WINVER 0x0501 means is that the program requires Windows XP or Server 2003 to run, and that it therefore can use Windows functionality up through that release. #define WINVER 0x0501意味着该程序需要运行Windows XP或Server 2003,因此它可以通过该版本使用Windows功能。

WINVER means Windows Version. WINVER表示Windows版本。 In a nutshell, if you're building for a particular version of Windows, some APIs are available that are not available on previous versions. 简而言之,如果您正在为特定版本的Windows构建,则可以使用某些以前版本不可用的API。

By defining WINVER macro you unhide a set of functions specific to a certain Windows version. 通过定义WINVER宏,您可以取消隐藏特定于某个Windows版本的一组函数。 For instance, if you define it as #define WINVER 0x0502 you will not able to use TaskDialog which is available only in Windows Vista. 例如,如果将其定义为#define WINVER 0x0502 ,则无法使用仅在Windows Vista中可用的TaskDialog For more detail you could read the Using the Windows Headers article in MSDN. 有关更多详细信息,请阅读MSDN中的“ 使用Windows标头”一文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM