1 #include <iostream>
 2 #include <objbase.h>
 3 #include <WinNT.h>
 4 
 5 int main()
 6 {
 7     using namespace std;
 8     OSVERSIONINFO osvi = {sizeof osvi};
 9     assert(0==offsetof(OSVERSIONINFO,dwOSVersionInfoSize));
10     GetVersionEx(&osvi);
11 
12     switch(osvi.dwPlatformId)
13     {
14         case VER_PLATFORM_WIN32s:
15             cout <<"机器是win32s系统"<<endl;
16             break;
17         case VER_PLATFORM_WIN32_WINDOWS:
18             cout<<"机器是win32_windows系统"<<endl;
19             break;
20         case VER_PLATFORM_WIN32_NT:
21             cout << "机器是NT系统。"<<endl;
22             break;
23         default:
24             cout<<"未能识别windows系统"<<endl;
25             break;
26     }
27     char version[128];
28     wcstombs(version,osvi.szCSDVersion,128);
29     
30     cout<<"CSDVersion:" <<version<<endl;
31     char c;
32     cin >>c;
33     
34 }
posted on 2008-12-24 15:59  Evilbaniry  阅读(286)  评论(0编辑  收藏  举报