0

I need to programatically find out what graphic card a screen is connected to using C#. This information is visible in DxDiag, speccy and even in windows advanced display settings view: Speccy

DxDiag

Windows

But how can I do this in C# myself?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • i never used this myself , but maybe worth further investigation [link](https://github.com/falahati/WindowsDisplayAPI.) – jeb May 31 '21 at 14:34

1 Answers1

0

The following is code by @NielW in C# detect which graphics card drives video

  ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
  foreach (ManagementObject mo in searcher.Get())
  {
    PropertyData currentBitsPerPixel = mo.Properties["CurrentBitsPerPixel"];
    PropertyData description = mo.Properties["Description"];
    if (currentBitsPerPixel != null && description != null)
    {
      if (currentBitsPerPixel.Value != null)
        System.Console.WriteLine(description.Value);
      }
    }
  }

There is a long talk in the link because they have issues getting multiples graphic cards' names. But this code should work and it shows all names of available graphic cards.

  • Thank you for the answer. It is not quite what I'm after though. What I need is to list my screens and see what graphic card they are connected to. Or to simplify I need to check how many screens are connected to each of the graphic cards. Querying WMIMonitorID class i can list the connected monitors: Manufacturer Model ------------ ----- Samsung SyncMaster Samsung SMBX2240 Samsung SMBX2240 CMN MIMO Monitor But I need to somehow connect these with the data in Win32_VideoController, but I cannot see any connection between them. – Andreas Fältman May 31 '21 at 06:37