代码如下 Double CPUtprt = 0;
try {
ManagementObjectSearcher mos = new ManagementObjectSearcher(@"root/WMI", "Select * From MSAcpi_ThermalZoneTemperature"); foreach (System.Management.ManagementObject mo in mos.Get()) { CPUtprt = Convert.ToDouble(Convert.ToDouble(mo.GetPropertyValue("CurrentTemperature").ToString()) - 2732) / 10; MessageBox.Show(CPUtprt.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } 在foreach和in那里一直出现问题,提示access denied,有人能帮我解决下吗? |