C# detect which graphics card drives video

前端 未结 5 656
萌比男神i
萌比男神i 2021-01-01 01:55

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 v

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-01 02:47

    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)

提交回复
热议问题