获取windows系统的版本名称
来源:互联网 发布:王圆箓 知乎 编辑:程序博客网 时间:2024/06/14 05:15
windows系统的版本信息从OSVERSIONINFO 结构体获取,该结构体的详细定义如下:</span>
<pre name="code" class="cpp">typedef struct _OSVERSIONINFOA { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion;//主版本号 DWORD dwMinorVersion;//次版本号 DWORD dwBuildNumber; DWORD dwPlatformId; CHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage} OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
void GetSystemName(std::string &strOsName){SYSTEM_INFO info; GetSystemInfo(&info); OSVERSIONINFOEX os; os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); strOsName = _T("unknown OperatingSystem.");if(GetVersionEx((OSVERSIONINFO *)&os)){ switch(os.dwMajorVersion) {case 4:switch(os.dwMinorVersion) { case 0:if(os.dwPlatformId == VER_PLATFORM_WIN32_NT)strOsName =_T("Windows NT 4.0"); else if(os.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)strOsName =_T("Windows 95");break;case 10:strOsName =_T("Windows 98");break;case 90:strOsName =_T("Windows Me");break;}break;case 5:switch(os.dwMinorVersion) { case 0:strOsName =_T("Windows 2000"); break;case 1:strOsName =_T("Windows XP"); break;case 2:if(os.wProductType==VER_NT_WORKSTATION && info.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64){strOsName =_T("Windows XP Professional x64 Edition");}else if(GetSystemMetrics(SM_SERVERR2)==0)strOsName =_T("Windows Server 2003"); else if(GetSystemMetrics(SM_SERVERR2)!=0)strOsName =_T("Windows Server 2003 R2");break;}break;case 6:switch(os.dwMinorVersion){case 0:if(os.wProductType == VER_NT_WORKSTATION)strOsName =_T("Windows Vista");elsestrOsName =_T("Windows Server 2008"); break;case 1:if(os.wProductType == VER_NT_WORKSTATION)strOsName =_T("Windows 7");elsestrOsName =_T("Windows Server 2008 R2");break;case 2:if(os.wProductType == VER_NT_WORKSTATION)strOsName =_T("Windows 8");elsestrOsName =_T("Windows Server 2012");break;case 3:if(os.wProductType == VER_NT_WORKSTATION)strOsName =_T("Windows 8.1");elsestrOsName =_T("Windows Server 2012 R2");break;}break;}} }
0 0
- 获取windows系统的版本名称
- 获取IOS设备的系统版本,硬件名称,mac地址
- 获取windows系统版本
- 获取Windows系统版本
- 获取windows操作系统名称和版本
- 获取WINDOWS系统版本的方法。。
- WIN获取系统版本和名称
- 获取windows系统版本信息
- 获取Windows系统版本信息
- Cpp获取Windows系统版本
- 获取Windwos的版本和名称
- 获取Windwos的版本和名称
- 获取浏览器的名称与版本信息
- C++中获取操作系统的名称和版本名称
- php for windows 的版本名称含义
- windows 下c++获取操作系统版本名称笔记
- 获取系统的版本
- 获取版本名称 VersionName
- CArchive 详解
- 联想笔试2011,顺时针输出矩阵
- 面向对象设计模式与原则
- 安装Weblogic时报Exception in thread "winRegistry" java.lang.UnsatisfiedLinkError
- 交替字符串
- 获取windows系统的版本名称
- 使用命令行工具管理Android项目(Managing Projects from the Command Line)
- 球安全软件厂商重新排座次 IBM首次杀入三甲
- 计科1111-1114班第二次实验作业(算法基本功 与 综合思考)
- ASP.NET 学习笔记 之 MasterPageFile母版页
- 《java语言程序设计》笔记(三)
- Freescale Cortex-A9 IMX6开发板产品板
- cocos2dx内存管理
- MySQL的词法分析漫谈