_WIN32_WINNT

30 篇文章 0 订阅
27 篇文章 0 订阅

Using the SDK Headers

This version of the Microsoft® Platform SDK targets applications for Microsoft Windows® 95, Microsoft Windows NT® 4.0, Microsoft Windows® 98, Microsoft Windows Millennium Edition (Windows Me), Microsoft Windows 2000, Microsoft Windows XP, and Microsoft Windows .NET Server using the header file conventions below.

The makefiles generated by Microsoft Visual C++® 5.0 and 6.0 target Windows NT 3.51 by default. To use functions introduced in Windows NT 4.0 or later, which are protected by conditional code, you must define the appropriate macros. Otherwise, you will receive the following error message from the compiler: error C2065: undeclared identifier. You may also need to ensure that the INCLUDE environment variable has the path to the Platform SDK header files listed before the path to the Visual C++ header files. Otherwise, you will receive error C2065 for items that were introduced after Visual C++ was released. The following table indicates the macros you must define to target each system using the SDK headers.

Minimum System RequiredMacros to Define
Windows 95 and
Windows NT 4.0
WINVER=0x0400
Windows 98 and
Windows NT 4.0
_WIN32_WINDOWS=0x0410 and WINVER=0x0400
Windows NT 4.0_WIN32_WINNT=0x0400 and WINVER=0x0400
Windows 98_WIN32_WINDOWS=0x0410
Windows 2000_WIN32_WINNT=0x0500 and WINVER=0x0500
Windows Me_WIN32_WINDOWS=0x0490
Windows XP and
Windows .NET Server
_WIN32_WINNT=0x0501 and WINVER=0x0501
Internet Explorer 3.0, 3.01, 3.02_WIN32_IE=0x0300
Internet Explorer 4.0_WIN32_IE=0x0400
Internet Explorer 4.01_WIN32_IE=0x0401
Internet Explorer 5.0, 5.0a, 5.0b_WIN32_IE=0x0500
Internet Explorer 5.01, 5.5_WIN32_IE=0x0501
Internet Explorer 6.0_WIN32_IE=0x0560 or
_WIN32_IE=0x0600

If you are writing your own makefile, the macros in Win32.mak can help you use the correct conventions. The value of _WIN32_WINNT is set in Win32.mak, depending on the platform you choose to target. For more information, see Building Applications Using Win32.mak.

The Platform SDK headers use guard statements to determine the system on which each function is supported. The following table describes these statements.

Guard StatementMeaning
#if _WIN32_WINNT >= 0x0400Windows NT 4.0 and later. It is not implemented in Windows 95.
#if _WIN32_WINDOWS >= 0x0410Windows 98. The image may not run on Windows 95.
#if _WIN32_WINDOWS >= 0x0490Windows Me. The image may not run on Windows 95/98, Windows NT, or Windows 2000.
#if _WIN32_WINNT >= 0x0500Windows 2000. The image may not run on Windows 95/98 or Windows NT.
#if _WIN32_WINNT >= 0x0501Windows XP. The image may not run on Windows 95/98, Windows NT, Windows Me, or Windows 2000.
#if _WIN32_IE >= 0x0300Internet Explorer 3.0 and later.
#if _WIN32_IE >= 0x0400Internet Explorer 4.0 and later.
#if _WIN32_IE >= 0x0401Internet Explorer 4.01 and later.
#if _WIN32_IE >= 0x0500Internet Explorer 5.0 and later.
#if _WIN32_IE >= 0x0501Internet Explorer 5.01 and later.
#if _WIN32_IE >= 0x0560Internet Explorer 6.0 and later
#if _WIN32_IE >= 0x0600Internet Explorer 6.0 and later

For example, if you do not include Win32.mak in your makefile, you need to explicitly define _WIN32_WINNT as 0x0500 to use the Windows 2000-specific material in the header files.

There are functions in Windows 95 OEM Service Release 2 that are guarded by (_WIN32_WINNT >= 0x0400), such as the Cryptographic Application Programming Interface (CryptoAPI). If you are writing an application specifically for Windows 95 OEM Service Release 2, and you want the header files to provide compile time access to these functions, it is necessary to define _WIN32_WINNT as 0x0400. Note that an application using these functions does not run correctly on the retail release of Windows 95. In general, applications expected to run on Windows 95 should be built without defining _WIN32_WINNT.

This version of the Platform SDK can also be used to build applications for 64-bit Windows. The header files use new data types that allow you to build both 32- and 64-bit versions of your application from a single source code base. For more information, see Getting Ready for 64-bit Windows.

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值