获取本地计算机的操作系统
OSVERSIONINFO os; os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&os); CString strOS; if(os.dwPlatformId == 0) { strOS = "Win32"; } else if(os.dwPlatformId == 1) { if(os.dwMinorVersion == 0) strOS = "Windows 95 "; else if(os.dwMinorVersion == 10) strOS = "Windows 98 "; strOS += os.szCSDVersion; } else if(os.dwPlatformId == 2) { if(os.dwMajorVersion ==3) { strOS = "Windows NT 3.51"; } else if(os.dwMajorVersion == 4) { strOS = "Windows NT 4.0"; } else if(os.dwMajorVersion == 5) { if(os.dwMinorVersion == 0) strOS = "Windows 2000 "; else if(os.dwMinorVersion == 1) strOS = "Windows XP "; else if(os.dwMinorVersion == 2) strOS = "Windows Server 2003 "; } else if(os.dwMajorVersion == 6) { if(os.dwMinorVersion == 0) strOS = "Windows Vista "; else if(os.dwMinorVersion == 1) strOS = "Windows 7 "; } strOS += os.szCSDVersion; } m_strVersion = strOS;