VC 判断操作系统版本

CString OSVer()
{
               OSVERSIONINFOEX os;
               ::ZeroMemory(&os,sizeof(os));
               os.dwOSVersionInfoSize=sizeof(os);
               ::GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&os));

               if(os.dwPlatformId==VER_PLATFORM_WIN32_NT && os.dwMajorVersion >=5)
               {
                             if(os.dwMinorVersion==0)
                                          return "Win2000";
                             else
                                          return "WinXP";
               }
               
               if(os.dwPlatformId ==VER_PLATFORM_WIN32_WINDOWS)
                             return "Win9x";
}

posted on 2007-04-20 16:03  路吾  阅读(3542)  评论(0编辑  收藏  举报

导航