您的位置:首页 > 编程语言 > C语言/C++

VC++ 获取windows系统的版本类型

2018-01-29 11:30 645 查看
转载自:https://www.cnblogs.com/JczmDeveloper/p/3513849.html

vc中获取windows版本信息,一般是调用GetVersionEx 这个API函数来获取的,这个API需要OSVERSIONINFOEX 这个结构体作为参数,OSVERSIONINFOEX 的对应的具体的OS版本类型详细如下:
Operating systemVersion numberdwMajorVersiondwMinorVersionOther
Windows 8.16.3*63OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2012 R26.3*63OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows 86.262OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 20126.262OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows 76.161OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2008 R26.161OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Server 20086.060OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION
Windows Vista6.060OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION
Windows Server 2003 R25.252GetSystemMetrics(SM_SERVERR2) != 0
Windows Home Server5.252OSVERSIONINFOEX.wSuiteMask & VER_SUITE_WH_SERVER
Windows Server 20035.252GetSystemMetrics(SM_SERVERR2) == 0
Windows XP Professional x64 Edition5.252(OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION) && (SYSTEM_INFO.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
Windows XP5.151Not applicable
Windows 20005.050Not applicable
* For applications that have been manifested for Windows 8.1. Applications not manifested for 8.1 will return the Windows 8 OS version value
(6.2). To 
 本人就获取 windows xp,vista,win8 ,win8.1 等系统版本信息 写了个函数,实现如下:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  版本号 操作系统