INFO: Using _WIN32_WINNT with the Platform SDK Header Files

ID: Q169088

The information in this article applies to:

SUMMARY

The header files of the Platform SDK now include _WIN32_WINNT guards. This constant should be defined in your makefile (either app specific, or for the whole project) so that you can take advantage of features that are specific to Windows NT. In the Platform SDK, _WIN32_WINNT is defined in Win32.mak (conditionally, depending on the platform you are targetting). More information about _WIN32_WINNT is provided in the release notes for the Platform SDK.

MORE INFORMATION

There are several features of Windows NT 4.0 that are not in previous version of Windows NT or in Windows 95. If you are developing code that uses the advanced features of the operating system, then you should define the _WIN32_WINNT constant to be 0x0400 (or greater for future features).

A partial list of areas that are affected by this definition is:

   Distributed Component Object Model (DCOM),
   several new window messages (WM_MOUSEWHEEL for instance),
   Waitable Timer API's,
   CopyFileEx API's,
   Fiber API's,
   FindFirst/NextFileEx API's.

Search the Platform SDK header files for a complete reference of the portions of the SDK that are affected by this definition.

For instance, placing the following in your source code will include the proper function prototypes and constant definitions for your code to use the advanced components of Windows NT:

   #define _WIN32_WINNT 0x0400
   #include <windows.h>

You may also make the definition in the makefile or project settings so that all source files can take advantage of the advanced components.

Keep in mind that making this definition and using advanced components of the operating system makes your code usable only on Windows NT 4.0 or later. If you want to make your code compatible with all Win32 platforms, then you should not use this definition or use the advanced features unless the code is running on a platform that supports the features. You may check the version of Windows programmatically and link dynamically to the proper API's if you detect that the platform supports them. This allows your code to degrade to more basic functionality if the advanced features of the operating system are not available.

REFERENCES

Please see the Platform SDK release notes for complete and up-to-date information regarding the use of _WIN32_WINNT.

Additional query words: bse ntonly

Keywords          : kbprg kbusage TlsHdr 
Platform          : NT WINDOWS
Issue type        : kbinfo

Last Reviewed: August 8, 1997