views:

536

answers:

3

hi all,

I was wondering how I can get the graphics card model/brand from code particularly from DirectX 9.0c (from within C++ code).

Thanks for any help!

A: 

In command prompt, run 'dxdiag'. It will open 'DirectX Diagnostic Tool'. Your graphics card will be listed there.

glasnt
err he was asking "from code"
lock
Indeed. You can even use various args to dxdiag to get display modes, if you're clever.
Stefan Kendall
You can use `dxdiag /t out.txt` to save DirectX info to a text file, but it's rather large for parsing. (Try `dxdiag /?` for more information.)
emddudley
Awww ... the OP edited his post ...
Goz
+2  A: 

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.

JPDecker
+1  A: 

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

legalize