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"; Else if(Os.dwminorversion = =Ten) 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 $"; 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;
Get the operating system of the local computer