直接调用下列代码即可
using namespace std;
struct WindowVersion{
DWORD marjorVer; //大版本号
DWORD minorVer; // 小版本号
DWORD buildNumber; //构建版本号
};
//获取系统版本
WindowVersion getSystemVersion()
{
WindowVersion wv;
OSVERSIONINFOW ver_info;
ver_info.dwOSVersionInfoSize = sizeof(ver_info); //初始化结构体大小
GetVersionEx(&ver_info);
wv.marjorVer = ver_info.dwMajorVersion;
wv.minorVer = ver_info.dwMinorVersion;
wv.buildNumber = ver_info.dwBuildNumber;
return wv;
}