OSVERSIONINFOEX WinVersion;
ZeroMemory(&WinVersion,sizeof(OSVERSIONINFOEX));
WinVersion.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX);
BOOL flag=(BOOL)GetVersionEx((OSVERSIONINFO *)&WinVersion);//得到当前版本号
float fSysVer = 0.;
fSysVer = WinVersion.dwMajorVersion + WinVersion.dwMinorVersion * 0.1;
win 95 4.0
win 98 4.1
win 2000win NT) 5.0
win xp(NT5.1) 5.1
win 2003 5.2
win Vista 6.0
win 7 6.1
typedef struct _OSVERSIONINFOEXW {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
WCHAR szCSDVersion[ 128 ];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
}