Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# detect which graphics card drives video

Tags:

c#

.net

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

like image 666
user209293 Avatar asked May 13 '11 12:05

user209293


1 Answers

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)

like image 186
Town Avatar answered Sep 22 '22 18:09

Town