码迷,mamicode.com
首页 > 其他好文 > 详细

获取本地计算机的操作系统

时间:2015-01-23 10:56:36      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

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;

 

获取本地计算机的操作系统

标签:

原文地址:http://www.cnblogs.com/liaocheng/p/4243475.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!