标签:rac ios server system space ret windowsxp sdn turn
#include "stdafx.h" #include <iostream> #include <windows.h> // VersionHelpers.h 依赖于 windows.h #include <VersionHelpers.h> // Windows SDK 8.1 才有喔 using namespace std; int _tmain(int argc, _TCHAR* argv[]) { // 是否大于等于 XP if (IsWindowsXPOrGreater()) cout << ">= XP" << endl; else cout << " < XP" << endl; // 是否大于等于 XP SP1 if (IsWindowsXPSP1OrGreater()) cout << ">= XP SP1" << endl; else cout << " < XP SP1" << endl; // 是否大于等于 XP SP2 if (IsWindowsXPSP2OrGreater()) cout << ">= XP SP2" << endl; else cout << " < XP SP2" << endl; // 是否大于等于 XP SP3 if (IsWindowsXPSP3OrGreater()) cout << ">= XP SP3" << endl; else cout << " < XP SP3" << endl; // 是否大于等于 Vista if (IsWindowsVistaOrGreater()) cout << ">= Vista" << endl; else cout << " < Vista" << endl; // 是否大于等于 Vista SP1 if (IsWindowsVistaSP1OrGreater()) cout << ">= Vista SP1" << endl; else cout << " < Vista SP1" << endl; // 是否大于等于 Vista SP2 if (IsWindowsVistaSP1OrGreater()) cout << ">= Vista SP2" << endl; else cout << " < Vista SP2" << endl; // 是否大于等于 Win8 if (IsWindows8OrGreater()) cout << ">= Win8" << endl; else cout << " < Win8" << endl; // 是否大于等于 Win8.1 if (IsWindows8Point1OrGreater()) cout << ">= Win8.1" << endl; else cout << " < Win8.1" << endl; // 是否为server版 if (IsWindowsServer()) cout << "server版" << endl; else cout << "非server版" << endl; // 以上的函数都是通过IsWindowsVersionOrGreater实现的 // Windows 2000的版本为5.0,所以我们也能够直接通过版本推断 if (IsWindowsVersionOrGreater(5, 0, 0)) cout << ">= Win 2000" << endl; else cout << " < Win 2000" << endl; system("pause"); return 0; }
另外。假设将平台工具集选择为支持XP的话。就不能用上面的函数了,会提示找不到VersionHelper.h头文件。
标签:rac ios server system space ret windowsxp sdn turn
原文地址:http://www.cnblogs.com/gavanwanggw/p/7364919.html