void cgetsysinfo::getdisplaycardinfo(dword &dwnum,cstring chcardname)
;//儲存keyserv下各子項的欄位名稱
//逐個列舉keyserv下的各子項字段儲存到name中
lresult = regenumkeyex(keyserv,i,name,&size,null,null,null,null);
//要讀取的子項不存在,即keyserv的子項全部遍歷完時跳出迴圈
if(lresult == error_no_more_items)
break;
//開啟keyserv的子項欄位為name所標識的字段的值儲存到key
lresult = regopenkeyex(keyserv,name,0,key_read,&key);
if (lresult != error_success)
size = 512;
//查詢key下的字段為group的子鍵欄位名儲存到name
lresult = regqueryvalueex(key,text("group"),0,&type,(lpbyte)name,&size);
if(lresult == error_file_not_found)
; //如果查詢到的name不是video則說明該鍵不是顯示卡驅動項
if(_tcscmp(text("video"),name)!=0)
; //如果程式繼續往下執行的話說明已經查到了有關顯示卡的資訊,所以在下面的**執行完之後要break第乙個for迴圈,函式返回
lresult = regopenkeyex(key,text("enum"),0,key_read,&key2);
regclosekey(key);
key = key2;
size = sizeof(count);
lresult = regqueryvalueex(key,text("count"),0,&type,(lpbyte)&count,&size);//查詢count欄位(顯示卡數目)
dwnum = count;//儲存顯示卡數目
for(int j=0;j ;
tchar name[64] = ;
wsprintf(name,text("%d"),j);
size = sizeof(sz);
lresult = regqueryvalueex(key,name,0,&type,(lpbyte)sz,&size);
lresult = regopenkeyex(keyenum,sz,0,key_read,&key2);
if (error_success)
size = sizeof(sz);
lresult = regqueryvalueex(key2,text("friendlyname"),0,&type,(lpbyte)sz,&size);
if(lresult == error_file_not_found)
; regclosekey(key2);
key2 = null;
};
regclosekey(key);
key = null;
break;
}}
獲取顯示卡記憶體
include pragma comment lib,guids.lib void cgetdisplaymemdlg onbutton1 ddcaps ddcaps ddcaps.dwsize sizeof ddcaps lpdd getcaps ddcaps,null lpdd release ...
python檢視顯示卡gpu資訊
需要使用pynvml庫 官網 現階段pip安裝的命令為 sudo pip install nvidia ml pyimport pynvml pynvml.nvmlinit 這裡的1是gpu id handle pynvml.nvmldevicegethandlebyindex 1 meminfo ...
python 檢視顯示卡gpu資訊
需要安裝pynvml庫。pip安裝的命令為 pip install nvidia ml py 如下 usr bin env python coding utf 8 time 2019 1 19 17 40 author xiaodai import pynvml pynvml.nvmlinit ha...