asp.net中如何通过 WmiMonitorID查询显示器序列号?
下面的代码可以获取到CPU的信息.但用WmiMonitorID就获取不了显示器信息了.小弟初学,请高手赐教,感激不尽!!程序代码:
protected void Page_Load(object sender, EventArgs e) { String Mycpu = ""; //CPU ManagementObjectSearcher CPU = new ManagementObjectSearcher("SELECT Name FROM Win32_Processor"); foreach (ManagementObject MyObject in CPU.Get()) { try { Mycpu = String.Format(MyObject["Name"].ToString()); } catch { } } showcpu.Text = Mycpu; //显示器 ManagementObjectSearcher disp = new ManagementObjectSearcher("SELECT * FROM WmiMonitorID"); foreach (ManagementObject MyObject in disp.Get()) { try { Mydisplay = String.Format(MyObject["SerialNumberID"].ToString()); } catch { } } showdisplay.Text = Mydisplay;报错信息如下图.