3

I'm writing an application that can be sped up a lot if a graphics card is available.

I've got the necessary DLL's to make my application utilize NVIDIA and AMD cards. But it requires being launched with specific command line arguments depending on which card is available.

I'd like to make an installer that will detect the specific brand of GPU and then launch the real application with the necessary command line arguments.

What's the best way to detect the type of card?

mocode8
  • 51
  • 1
  • 2
  • 4
  • Have you checked the answers of these two questions? http://stackoverflow.com/questions/13345499/how-to-determine-which-graphic-card-is-in-use-win32 and http://stackoverflow.com/questions/1090261/get-the-graphics-card-model – Zimano Nov 05 '16 at 22:49
  • 1
    http://superuser.com/a/723574 – Mark Setchell Nov 05 '16 at 22:50
  • 2
    You need to detect the card at runtime, not during install. The user can always remove one video card and replace it with one with a different chipset. – 1201ProgramAlarm Nov 05 '16 at 23:24
  • 1
    All the links post a method how to do it but no sample code. I'm lost trying to use GetAdapterIdentifier and IDirect3D9 :( – mocode8 Nov 05 '16 at 23:31

2 Answers2

3

You have to detect it during runtime by using OpenGL. Use the command glGetString(GL_VENDOR) or GL_VERSION.

To do so using Direct3D 9 API:

Step 1 D3DADAPTER_IDENTIFIER AdapterIdentifier;

Step 2 m_pD3D->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &AdapterIdentifier);

Step 3 Get the max size of the graphics card identifier string const int cch = sizeof(AdapterIdentifier.Description);

Step 4 Define a TCHAR to hold the description TCHAR szDescription[cch];

Step 5 Use the unicode DX utility to convert the char string to TCHAR DXUtil_ConvertAnsiStringToGenericCch( szDescription, AdapterIdentifier.Description, cch );

Credit goes to: Anonymous_Poster_* @ http://www.gamedev.net/topic/358770-obtain-video-card-name-size-etc-in-c/

Asesh
  • 3,186
  • 2
  • 21
  • 31
MichaelMMeskhi
  • 659
  • 8
  • 26
0

@mark-setchell already post the link from superuser.com above. I just want to make it easier for people to find out the solution.

wmic path win32_VideoController get name 
wizawu
  • 1,881
  • 21
  • 33