admin 管理员组文章数量: 887006
#include <stdio.h>
#include <windows.h>
#include <iostream>
#include <DXGI.h>
#include <vector>
#pragma comment(lib,"DXGI.lib")
#pragma warning(disable: 4996)
//获取操作系统信息
void GetOsInfo(char * pWindowsVersion,int * pWindowsOSBit)
{
//获取操作系统版本
char WindowsVersion[256] = { 0 };
//获取8.1以上版本操作系统名称
//先判断是否为win8.1或win10
HMODULE hm = NULL;
if (hm = LoadLibrary(TEXT("ntdll.dll")))
{
DWORD dwMajor = 0, dwMinor = 0, dwBuildNumber = 0;
typedef void (WINAPI *getver)(DWORD*, DWORD*, DWORD*);
getver gv = NULL;
gv = (getver)GetProcAddress(hm, "RtlGetNtVersionNumbers");
if (gv)
{
gv(&dwMajor, &dwMinor, &dwBuildNumber);
//printf("Major is %d\nMinor is %d\nOptional Build is %d\n", dwMajor, dwMinor, dwBuildNumber);
if (dwMajor == 6 && dwMinor == 3) //win 8.1
{
sprintf_s(WindowsVersion, "%s", "Windows 8.1");
}
else if (dwMajor == 10 && dwMinor == 0) //win 10
{
sprintf_s(WindowsVersion, "%s", "Windows 10");
}
}
FreeLibrary(hm);
//如果没有输出版本
if (WindowsVersion[0] == 0)
{
//获取8.1以下版本操作系统名称
// get os name according to version number
OSVERSIONINFO osver = { sizeof(OSVERSIONINFO) };
GetVersionEx(&osver);
if (osver.dwMajorVersion == 5 && os
版权声明:本文标题:windows获取系统显卡信息(一) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1732782400h1554852.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论