SDK的使用有些需要注意的地方:
例如Microsoft Platform SDK, August 2001 Edition版本的SDK,他的目标系统是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 。 如果你写的程序准备在Win 95上运行,但是使用了Win 98才有的特性,那么该程序在Win 95上运行时就会出问题。 所以SDK必须对程序的目标平台加以评估,决定是否可以提供相应功能给用户。 SDK通过宏来实现这个目标,给不同的系统定义不同的数字,这样你在VC中用宏定义程序的目标运行平台,SDK根据你的定义决定开放哪些功能。
SDK使用下面的方法决定提供哪些功能:
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 >& |