获取系统版本信息和处理器信息

来源:互联网 发布:网络用语uc是什么意思 编辑:程序博客网 时间:2024/05/21 09:18
// GetSystemInfo.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>#include <windows.h>#include <iomanip>using namespace std;int main(){    SYSTEM_INFO systemInfo;    GetSystemInfo(&systemInfo);    //setw();相对于右对齐n位  setw()只对其后面紧跟的输出产生作用    cout <<setw(20) << "处理器掩码: " << systemInfo.dwActiveProcessorMask << endl    <<setw(20) << "处理器个数: " << systemInfo.dwNumberOfProcessors << endl    <<setw(20) << "处理器分页大小: " << systemInfo.dwPageSize << endl    <<setw(20) << "处理器类型: " << systemInfo.dwProcessorType << endl    <<setw(20) << "最大寻址单元: " << systemInfo.lpMaximumApplicationAddress << endl    <<setw(20) << "最小寻址单元: " << systemInfo.lpMinimumApplicationAddress << endl    <<setw(20) << "处理器等级: " << systemInfo.wProcessorLevel << endl    <<setw(20) << "处理器版本: " << systemInfo.wProcessorRevision << endl;//  LPOSVERSIONINFOA version;    OSVERSIONINFOEX version; //获取系统版本信息    version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);      GetVersionEx((LPOSVERSIONINFOA)&version);    cout<<"System info:"<<endl;      cout<<"Version:"<<version.dwMajorVersion<<"."<<version.dwMinorVersion          <<" Build "<<version.dwBuildNumber          <<" Service Pack "<<version.wServicePackMajor<<"."<<version.wServicePackMinor<<endl;     return 0;}        处理器掩码: 15        处理器个数: 4    处理器分页大小: 4096        处理器类型: 586      最大寻址单元: 7FFEFFFF      最小寻址单元: 00010000        处理器等级: 6        处理器版本: 15363System info:Version:6.1 Build 7601 Service Pack 1.0Press any key to continue
0 1
原创粉丝点击