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 Required | Macros 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 Statement | Meaning |
---|---|
#if _WIN32_WINNT >= 0x0400 | Windows NT 4.0 and later. It is not implemented in Windows 95. |
#if _WIN32_WINDOWS >= 0x0410 | Windows 98. The image may not run on Windows 95. |
#if _WIN32_WINDOWS >= 0x0490 | Windows Me. The image may not run on Windows 95/98, Windows NT, or Windows 2000. |
#if _WIN32_WINNT >= 0x0500 | Windows 2000. The image may not run on Windows 95/98 or Windows NT. |
#if _WIN32_WINNT >= 0x0501 | Windows XP. The image may not run on Windows 95/98, Windows NT, Windows Me, or Windows 2000. |
#if _WIN32_IE >= 0x0300 | Internet Explorer 3.0 and later. |
#if _WIN32_IE >= 0x0400 | Internet Explorer 4.0 and later. |
#if _WIN32_IE >= 0x0401 | Internet Explorer 4.01 and later. |
#if _WIN32_IE >= 0x0500 | Internet Explorer 5.0 and later. |
#if _WIN32_IE >= 0x0501 | Internet Explorer 5.01 and later. |
#if _WIN32_IE >= 0x0560 | Internet Explorer 6.0 and later |
#if _WIN32_IE >= 0x0600 | Internet 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.