در مورد به دست آوردن تعداد شما با استفاده از API ارائه شده توسط NVIDIA میتونی این کا رو انجام بدی، من الان این کد رو با VC 2012 نوشتم و روی ویندوز 7 نسخه 64بیتی هم تست کردم.
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
#define NVAPI_MAX_PHYSICAL_GPUS 64
typedef int *(*NvAPI_QueryInterface_t)(unsigned int offset);
typedef int (*NvAPI_Initialize_t)();
typedef int (*NvAPI_EnumPhysicalGPUs_t)(int **handles, int *count);
int _tmain(int argc, _TCHAR* argv[])
{
HMODULE hmod = LoadLibraryA("nvapi.dll");
if (hmod == NULL)
{
cerr << "Couldn't find nvapi.dll" << endl;
return 1;
}
/*----------------------------------*/
NvAPI_QueryInterface_t NvAPI_QueryInterface = NULL;
NvAPI_Initialize_t NvAPI_Initialize = NULL;
NvAPI_EnumPhysicalGPUs_t NvAPI_EnumPhysicalGPUs = NULL;
/*----------------------------------*/
NvAPI_QueryInterface = (NvAPI_QueryInterface_t) GetProcAddress(hmod, "nvapi_QueryInterface");
NvAPI_Initialize = (NvAPI_Initialize_t) (*NvAPI_QueryInterface)(0x0150E828);
NvAPI_EnumPhysicalGPUs = (NvAPI_EnumPhysicalGPUs_t) (*NvAPI_QueryInterface)(0xE5AC921F);
/*----------------------------------*/
if (NvAPI_Initialize == NULL || NvAPI_EnumPhysicalGPUs == NULL ||
NvAPI_EnumPhysicalGPUs == NULL)
{
cerr << "Couldn't get functions in nvapi.dll" << endl;
return 2;
}
/*----------------------------------*/
(*NvAPI_Initialize)();
int gpuCount = 0;
int *gpuHandles[NVAPI_MAX_PHYSICAL_GPUS] = { NULL };
/*----------------------------------*/
(*NvAPI_EnumPhysicalGPUs)(gpuHandles, &gpuCount);
cout<<"GPU Count: "<<gpuCount<<endl;
system("pause");
return 0;
}
البته با WMI هم باید بشه این کارو انجام داد.