Use of Windows Platform SDK header files

Source: Internet
Author: User

Note the following when using the SDK:
For example, Microsoft platform SDK and August 2001 edition SDK, whose target system is 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. If the program you write is ready to run on Win 95, but the features of WIN 98 are used, problems will occur when the program runs on Win 95. Therefore, the SDK must evaluate the target platform of the program to determine whether the corresponding functions can be provided to users. The SDK uses macros to achieve this goal and defines different numbers for different systems. In this way, you can use macros to define the program's target running platform in VC. the SDK determines which functions are available based on your definition.

The SDK uses the following method to determine which functions are provided:

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

The Platform definition is as follows. You need to add up or down a macro definition in the code to specify the Target Platform:

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

For example:
The system before Win98 does not provide APIs related to multiple monitors
The SDK has a corresponding definition, indicating that only systems with Windows 98 and above can use the following content:
# If (winver> = 0x0500)
# Define sm_xvirtualscreen 76
# Define sm_yvirtualscreen 77
# Define sm_cxvirtualscreen 78
# Define sm_cyvirtualscreen 79
# Define sm_cmonitors 80
# Define sm_samedisplayformat 81
# Endif/* winver> = 0x0500 */

If your program is going to run on Win95, the program defines # define winver = 0x0400. When sm_cmonitors is used, the compiler reports an error saying that the symbol cannot be found.

Tip: If a Windows macro is used, if no definition is found in the compiler report, the SDK may not support your defined target system. You need to increase the definition of your target system in the program, for example, # define winver 0x0500, so that the compilation is successful!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.