- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 c# 语言中使用 wmi objecrs。如何获得 CPU Temp?我的代码:
我的 Select 查询返回空值并且 foreach 不工作,因为我的搜索器对象是空的。
尝试 { ManagementObjectSearcher 搜索器 = 新的 ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_TemperatureProbe");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_TemperatureProbe instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("CurrentReading: {0}", queryObj["CurrentReading"]);
}
}
catch (ManagementException)
{
}
请给我澄清代码。我在谷歌搜索,必应但我找不到任何好的代码。我使用 MSAcpi_ThermalZoneTemperature 但出现错误。
最好的问候
最佳答案
CurrentReading
未在当前版本中实现。
来自documentation :
Most of the information that the
Win32_TemperatureProbe
WMI class provides comes from SMBIOS. Real-time readings for theCurrentReading
property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate theCurrentReading
property. TheCurrentReading
property's presence is reserved for future use.
关于wmi - 当使用 WIN32_TempretureProbe 时,我检索到的值为 Null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16886287/
我是一名优秀的程序员,十分优秀!