首页 > 其他 > 详细

获取操作系统版本号

时间:2014-05-14 01:37:47      阅读:654      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
 1 #include "windows.h"
 2 #include "iostream"
 3 
 4 void main(){
 5     DWORD dwIdThis=GetCurrentProcessId();
 6 
 7     DWORD dwVerReq=GetProcessVersion(dwIdThis);
 8     WORD wMajorReq=(WORD)(dwVerReq>>16);
 9     WORD wMinorReq=(WORD)(dwVerReq & 0xffff);
10 
11     printf("Process ID :%d ,requires OS:%d.%d\n",dwIdThis,wMajorReq,wMinorReq);
12 
13     OSVERSIONINFOEX osvix;
14 
15     ZeroMemory(&osvix,sizeof(osvix));
16     osvix.dwOSVersionInfoSize=sizeof(osvix);
17 
18     GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osvix));
19     printf("Running on OS:%d.%d\n",20         osvix.dwMajorVersion,osvix.dwMinorVersion);
21 
22     if(osvix.dwPlatformId==VER_PLATFORM_WIN32_NT && osvix.dwMajorVersion>=5){
23         
24         SetPriorityClass(
25             GetCurrentProcess(),
26             HIGH_PRIORITY_CLASS);
27         printf("Task Manager should now indicate this");
28         printf("process is high priority.\n");
29     
30     }
31 
32     getchar();
33 }
34  
View Code

 

获取操作系统版本号,布布扣,bubuko.com

获取操作系统版本号

原文:http://www.cnblogs.com/593213556wuyubao/p/3723964.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!