TRACE("获取系统版本信息------------------------------------------------------\n");
OSVERSIONINFOEX OSVersionInfoEx = {sizeof(OSVERSIONINFOEX)};
GetVersionEx((LPOSVERSIONINFO)&OSVersionInfoEx);
TRACE("MajorVersion=%d MinorVersion=%d BuildNumber=%d \n"
"PlatformId=%d ServicePackMajor=%d ServicePackMinor=%d \n",
OSVersionInfoEx.dwMajorVersion, OSVersionInfoEx.dwMinorVersion, OSVersionInfoEx.dwBuildNumber,
OSVersionInfoEx.dwPlatformId, OSVersionInfoEx.wServicePackMajor, OSVersionInfoEx.wServicePackMinor);
TRACE("判断系统版本Win2000以上------------------------------------------------------\n");
// 设置要比较的版本信息
ZeroMemory(&OSVersionInfoEx, sizeof(OSVERSIONINFOEX));
OSVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
OSVersionInfoEx.dwMajorVersion = 5;
OSVersionInfoEx.dwMinorVersion = 0;
OSVersionInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT;
// 设置 MASK
DWORDLONG dwlConditionMask = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_PLATFORMID, VER_EQUAL);
if (!VerifyVersionInfo(&OSVersionInfoEx, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, dwlConditionMask))
{
MessageBox(NULL, _T("本程序须运行于windows 2000以上。"), _T("错误"), MB_ICONERROR);
return 0;
}