2016-05-30 64 views
3

我用這個代碼查找顯卡:如何查找所有圖形卡? C#

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

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

My Graphic Cards

,但結果是:的NVIDIA Quadro K6000

如何找到所有的顯卡?

回答

6

the MSDN page的第一行寫着:

[該Win32_DisplayConfiguration WMI類不再可供用作Windows Server 2008的相反,在Win32_VideoController,Win32_DesktopMonitor和CIM_VideoControllerResolution類使用性質。 ]

所以我建議你從Win32_VideoController開始。

+0

感謝您的回答。如何找到活動(使用中)的圖形卡? – MTSS