I was wondering how I can get the graphics card model/brand from code particularly from DirectX 9.0c (from within C++ code).
5 Answers
The easiest way in DirectX is through IDirect3D9::GetAdapterIdentifier.
Just create a D3DADAPTER_IDENTIFIER9 object, pass a pointer to it to GetAdapterIdentifier. DirectX fills out the graphics card description as a string in the Description field. It also includes information on which display device the card is, and what driver version you have.
You get something like this:
- Description: "NVIDIA GeForce GTX 570"
- Device: "\.\DISPLAY1"
- Driver: "nvd3dum.dll"

- 1,532
- 15
- 18
-
Thanks got the information I needed and was very useful not sure why this isn't the accepted answer. – Jeremy Trifilo Mar 17 '13 at 20:27
-
... because it's three years later. :) – Decker Nov 27 '14 at 19:53
At runtime, you can query the device model and vendor:
In OpenGL, use the command glGetString(GL_VENDOR) or GL_RENDERER or GL_VERSION to get the information you're after.
In DirectX 9, it appears the info is in the Microsoft config system, and is queried from the device database. It's section 3 of this document, which also has example code: http://msdn.microsoft.com/en-us/library/bb204848(VS.85).aspx Using the same system you can get such information as the amount of ram the video card has, the driver number, etc.

- 459
- 3
- 10
Take a look at Chapter 2. Direct3D from my book The Direct3D Graphics Pipeline. See section 2.12, Identifying a Particular Device.

- 2,214
- 18
- 25
You can use "DirecX Diagnostic Tool" API, like in sample DxDiagOutput from DX SDK http://msdn.microsoft.com/en-us/library/ee416986%28v=VS.85%29.aspx

- 6,558
- 4
- 47
- 75
IDirect3D9* d3dobject = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS d3dpresent;
memset(&d3dpresent, 0, sizeof(D3DPRESENT_PARAMETERS));
d3dpresent.Windowed = TRUE;
d3dpresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
UINT adaptercount = d3dobject->GetAdapterCount();
D3DADAPTER_IDENTIFIER9* adapters = (D3DADAPTER_IDENTIFIER9*)malloc(sizeof(D3DADAPTER_IDENTIFIER9) * adaptercount);
for (int i = 0; i < adaptercount; i++)
{
d3dobject->GetAdapterIdentifier(i, 0, &(adapters[i]));
}
Then get the description of adapters (adapters->Description)

- 9
- 1
-
You don't need D3DPRESENT_PARAMETERS here. It's used for device creation in D3D9. Adapter info is available without it. – Ihor Baklykov Sep 04 '19 at 09:10