Testing for other conditions involves a simple modification to this code. For example, the following code verifies that the application is running on Windows 2000 Professional.BOOL Is_Win2000_Professional ()
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0; // Initialize the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 5;
osvi.wProductType = VER_NT_WORKSTATION; // Initialize the condition mask. VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION,
VER_GREATER_EQUAL );
VER_SET_CONDITION( dwlConditionMask, VER_PRODUCT_TYPE,
VER_EQUAL ); // Perform the test. return VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_PRODUCT_TYPE,
dwlConditionMask);
}
{
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0; // Initialize the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = 5;
osvi.wProductType = VER_NT_WORKSTATION; // Initialize the condition mask. VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION,
VER_GREATER_EQUAL );
VER_SET_CONDITION( dwlConditionMask, VER_PRODUCT_TYPE,
VER_EQUAL ); // Perform the test. return VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_PRODUCT_TYPE,
dwlConditionMask);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货