获取系统版本号
1 #define WINXP 5 2 #define WIN7 6 3 #define WIN7X32 632 4 //获取系统版本号 5 DWORD GetOSVer() 6 { 7 OSVERSIONINFO osver; 8 osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 9 LPSYSTEM_INFO lpSystemInfo=new SYSTEM_INFO; 10 GetNativeSystemInfo(lpSystemInfo); 11 GetVersionEx(&osver); 12 if(osver.dwPlatformId == 2) 13 { 14 if(osver.dwMajorVersion == WINXP && osver.dwMinorVersion == 1) 15 { 16 17 return WINXP; 18 } 19 if (osver.dwMajorVersion == WIN7 && osver.dwMinorVersion == 1) 20 { 21 22 return WIN7X32; 23 } 24 } 25 return 0; 26 }