gpt4 book ai didi

wmi - 当使用 WIN32_TempretureProbe 时,我检索到的值为 Null?

转载 作者:行者123 更新时间:2023-12-04 17:15:29 26 4
gpt4 key购买 nike

我在 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 the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property. The CurrentReading property's presence is reserved for future use.

关于wmi - 当使用 WIN32_TempretureProbe 时,我检索到的值为 Null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16886287/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com