Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Determine graphics card

Determine graphics card

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorialquestionlearning
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    khb
    wrote on last edited by
    #1

    Hi together, I need your help: I have to find out what kind of graphics card is installed on a PC (e.g. ATI or NVIDIA and what kind of model). More specifically, I need to know if the card supports the languages cg or glsl, but that can be derived from the graphics card model, of course. Can anybody give me a hint on how to do that? :rose:Thank you very much in advance. Regards, Marcus.

    N V 2 Replies Last reply
    0
    • K khb

      Hi together, I need your help: I have to find out what kind of graphics card is installed on a PC (e.g. ATI or NVIDIA and what kind of model). More specifically, I need to know if the card supports the languages cg or glsl, but that can be derived from the graphics card model, of course. Can anybody give me a hint on how to do that? :rose:Thank you very much in advance. Regards, Marcus.

      N Offline
      N Offline
      NiceNaidu fo
      wrote on last edited by
      #2

      You can use a simple diagnostic program called dxdiag to determine your computer's hardware, operating system, and graphics card. To use the dxdiag program: 1. Select "Start" 2. Choose "Run." 3. Type "dxdiag" in the box and click "OK." 4. Click "Yes" to the prompt, and the program will begin running. 5. Select the "Display" tab and the Name listed under the "Device" section is the name of your graphics card. Appu.. "If you judge people, you have no time to love them."

      K 1 Reply Last reply
      0
      • N NiceNaidu fo

        You can use a simple diagnostic program called dxdiag to determine your computer's hardware, operating system, and graphics card. To use the dxdiag program: 1. Select "Start" 2. Choose "Run." 3. Type "dxdiag" in the box and click "OK." 4. Click "Yes" to the prompt, and the program will begin running. 5. Select the "Display" tab and the Name listed under the "Device" section is the name of your graphics card. Appu.. "If you judge people, you have no time to love them."

        K Offline
        K Offline
        khb
        wrote on last edited by
        #3

        Thank you very much for the detailed instruction. The information presented in the dialog is exacly what I was looking for, but I need it in a C++ program. I forgot to mention that, but that's why I posted my question to the C++ forum :) Do you have any idea how to do that? Thanks again! Regards, Marcus.

        1 Reply Last reply
        0
        • K khb

          Hi together, I need your help: I have to find out what kind of graphics card is installed on a PC (e.g. ATI or NVIDIA and what kind of model). More specifically, I need to know if the card supports the languages cg or glsl, but that can be derived from the graphics card model, of course. Can anybody give me a hint on how to do that? :rose:Thank you very much in advance. Regards, Marcus.

          V Offline
          V Offline
          Viorel
          wrote on last edited by
          #4

          If no other solutions, you can try Windows Management Instrumentation (WMI), which allows you to find some hardware and software details programmatically. The next sample displays available video controller(s):

          #include "stdafx.h"
          
          #define _WIN32_WINNT 0x0400
          #include 
          #include 
          #include 
          
          #pragma comment(lib, "wbemuuid.lib")
          
          _COM_SMARTPTR_TYPEDEF(IWbemLocator, __uuidof(IWbemLocator));
          _COM_SMARTPTR_TYPEDEF(IWbemServices, __uuidof(IWbemServices));
          _COM_SMARTPTR_TYPEDEF(IEnumWbemClassObject, __uuidof(IEnumWbemClassObject));
          _COM_SMARTPTR_TYPEDEF(IWbemClassObject, __uuidof(IWbemClassObject));
          
          
          void ShowVideoControllers()
          {
              CoInitializeEx(NULL, COINIT_MULTITHREADED);
              CoInitializeSecurity(
                  NULL,
                  -1,
                  NULL,
                  NULL,
                  RPC_C_AUTHN_LEVEL_DEFAULT,
                  RPC_C_IMP_LEVEL_IMPERSONATE,
                  NULL,
                  EOAC_NONE,
                  NULL);
          
              IWbemLocatorPtr locator;
          
              CoCreateInstance(
                  CLSID_WbemLocator,             
                  0, 
                  CLSCTX_INPROC_SERVER, 
                  IID_IWbemLocator, 
                  (LPVOID *)&locator
                  );
          
              IWbemServicesPtr services;
          
              locator->ConnectServer(
                   _bstr_t(L"ROOT\\CIMV2"),
                   NULL,
                   NULL,
                   0,
                   NULL,
                   0,
                   0,
                   &services
                   );
          
          
              IEnumWbemClassObjectPtr enumerator;
              services->ExecQuery(
                  bstr_t("WQL"), 
                  bstr_t("SELECT * FROM Win32_VideoController"),
                  WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
                  NULL,
                  &enumerator);
          
              IWbemClassObjectPtr object = 000;
          
              for( ; ; )
              {
                  ULONG ret;
                  enumerator->Next(WBEM_INFINITE, 1, &object, &ret);
          
                  if( ret == 0) break;
          
                  _variant_t variant;
                  object-&Get(L"Name", 0, &variant, 0, 0);
                  _bstr_t model = variant;
          
                  MessageBox(0, model, "", MB_OK);
              }
              // TODO: check HRESULTs for error
              // TODO: release objects
          }
          

          Hope it helps. -- modified at 9:41 Wednesday 21st June, 2006

          K 1 Reply Last reply
          0
          • V Viorel

            If no other solutions, you can try Windows Management Instrumentation (WMI), which allows you to find some hardware and software details programmatically. The next sample displays available video controller(s):

            #include "stdafx.h"
            
            #define _WIN32_WINNT 0x0400
            #include 
            #include 
            #include 
            
            #pragma comment(lib, "wbemuuid.lib")
            
            _COM_SMARTPTR_TYPEDEF(IWbemLocator, __uuidof(IWbemLocator));
            _COM_SMARTPTR_TYPEDEF(IWbemServices, __uuidof(IWbemServices));
            _COM_SMARTPTR_TYPEDEF(IEnumWbemClassObject, __uuidof(IEnumWbemClassObject));
            _COM_SMARTPTR_TYPEDEF(IWbemClassObject, __uuidof(IWbemClassObject));
            
            
            void ShowVideoControllers()
            {
                CoInitializeEx(NULL, COINIT_MULTITHREADED);
                CoInitializeSecurity(
                    NULL,
                    -1,
                    NULL,
                    NULL,
                    RPC_C_AUTHN_LEVEL_DEFAULT,
                    RPC_C_IMP_LEVEL_IMPERSONATE,
                    NULL,
                    EOAC_NONE,
                    NULL);
            
                IWbemLocatorPtr locator;
            
                CoCreateInstance(
                    CLSID_WbemLocator,             
                    0, 
                    CLSCTX_INPROC_SERVER, 
                    IID_IWbemLocator, 
                    (LPVOID *)&locator
                    );
            
                IWbemServicesPtr services;
            
                locator->ConnectServer(
                     _bstr_t(L"ROOT\\CIMV2"),
                     NULL,
                     NULL,
                     0,
                     NULL,
                     0,
                     0,
                     &services
                     );
            
            
                IEnumWbemClassObjectPtr enumerator;
                services->ExecQuery(
                    bstr_t("WQL"), 
                    bstr_t("SELECT * FROM Win32_VideoController"),
                    WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
                    NULL,
                    &enumerator);
            
                IWbemClassObjectPtr object = 000;
            
                for( ; ; )
                {
                    ULONG ret;
                    enumerator->Next(WBEM_INFINITE, 1, &object, &ret);
            
                    if( ret == 0) break;
            
                    _variant_t variant;
                    object-&Get(L"Name", 0, &variant, 0, 0);
                    _bstr_t model = variant;
            
                    MessageBox(0, model, "", MB_OK);
                }
                // TODO: check HRESULTs for error
                // TODO: release objects
            }
            

            Hope it helps. -- modified at 9:41 Wednesday 21st June, 2006

            K Offline
            K Offline
            khb
            wrote on last edited by
            #5

            Thank you! I'll try it. Regards, Marcus.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups