user209293 user209293 - 1 year ago 91
C# Question

C# detect which graphics card drives video

My C# application sits on the embedded box which has Intel motherboard and graphics chipset. ATI graphics card is put on to PCI express. Generally graphics card drives the video, but if ATI card fails then the video comes out from graphics chipset.

I have to detect the failure of ATI graphics card for diagnostic purposes.

Any ideas/sample code on how to do this.

Thanks in advance
Raju

Answer Source

This should hopefully get you started.

Add a reference to System.Management, then you can do this:

ManagementObjectSearcher searcher 
     = new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");

    string graphicsCard = string.Empty;
    foreach (ManagementObject mo in searcher.Get())
    {
        foreach (PropertyData property in mo.Properties)
        {
           if (property.Name == "Description")
           {
               graphicsCard = property.Value.ToString();
           }
        }
    }

In my case, graphicsCard is equal to

NVIDIA GeForce 8400 GS (Microsoft Corporation - WDDM v1.1)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download