_WIN32_WINNT的含义

来源:互联网 发布:招淘宝美工 编辑:程序博客网 时间:2024/05/17 01:47

本文转载自http://tsing01.blog.163.com/blog/static/20595728320127313524286/

从 Visual C++ 2008 开始,Visual C++ 不支持面向 Windows 95、Windows 98、Windows ME 或 Windows NT。如果您的 WINVER 或 _WIN32_WINNT 宏被指定到这些 Windows 版本之一,则需要修改宏。当升级从 Visual C++ 的以前版本创建的项目时,如果将 WINVER 或 _WIN32_WINNT 宏指定到不再受支持的 Windows 版本,可能会看到与这些宏相关的编译错误。


若要修改宏,请在头文件中添加以下行:


#define WINVER 0x0500 #define _WIN32_WINNT 0x0500

这将以 Windows 2000 操作系统为目标。其他有效值包括 0x0501(用于 Windows XP)、0x0502(用于 Windows Server 2003)和 0x0600(用于 Windows Vista)。

需要你自已在stdafx.h头文件中定义。编译器根据此宏来确定windows的版本,如果你需要使用高版本的WIN32函数,只有你定义了此宏后才能使用

Windows XP _WIN32_WINNT>=0x0501 
Windows 2000 _WIN32_WINNT>=0x0500 
Windows NT 4.0 _WIN32_WINNT>=0x0400 
Windows Me _WIN32_WINDOWS=0x0490 
Windows 98 _WIN32_WINDOWS>=0x0410 
Internet Explorer 6.0 _WIN32_IE>=0x0600 
Internet Explorer 5.01, 5.5 _WIN32_IE>=0x0501 
Internet Explorer 5.0, 5.0a, 5.0b _WIN32_IE>=0x0500 
Internet Explorer 4.01 _WIN32_IE>=0x0401 
Internet Explorer 4.0 _WIN32_IE>=0x0400 
Internet Explorer 3.0, 3.01, 3.02 _WIN32_IE>=0x0300

0 0