通过 ManagementObjectSearcher 类,初始化查询Win32_VideoController 信息,遍历集合获取 PNPDeviceID 属性,可获取显卡信息
/// <summary>
/// 显卡PNPDeviceID
/// </summary>
public string GetVideoPNPID()
{
string st = "";
ManagementObjectSearcher mos = new ManagementObjectSearcher("Select * from Win32_VideoController");
foreach (ManagementObject mo in mos.Get())
{
st = mo["PNPDeviceID"].ToString();
}
return st;
}