8

How to get the CPU Temperature info from Bios using c# I gave a try to the code in CPU temperature monitoring

But no luck. 'enumerator.Current' threw an exception.

How can i achieve this ? Thanks.

Error :

"This system doesn't support the required WMI objects(1) - check the exception file \r\nNot supported \r\n\r\n at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)\r\n at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()\r\n at CedarLogic.WmiLib.SystemStatistics.RefreshReadings() in D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\WmiLib\SystemStatistics.cs:line 25\r\n at CedarLogic.WmiLib.SystemStatistics.get_CurrentTemperature() in D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\WmiLib\SystemStatistics.cs:line 87\r\n at TemperatureMonitor.SystemTrayService.CheckSupport() in D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\TemperatureMonitor\SystemTrayService.cs:line 260"

4

3 回答 3

2

您需要支持许多不同的硬件传感器来收集温度数据。更好的方法是准备好使用以下解决方案:

1) 打开硬件监视器 - 开源 .NET 2.0 应用程序:

http://openhardwaremonitor.org/

2) Core Temp - 免费应用程序和 .NET API 来获取温度数据:

http://www.alcpu.com/CoreTemp/developers.html

于 2010-09-03T07:08:34.547 回答
1

我知道这个线程很旧,但我想用一些不同的方法来添加它。从主板上的 I/O 芯片上获取品牌/型号,并获取所述 I/O 芯片的数据表(我将使用 ITE IT8783F 芯片作为参考)。查看环境控制器之类的东西并计算访问和读取端口。是的......你必须了解 HEX 和 MSB 和 LSB,我不会在这里进行计算/解释(超出范围)。现在,在本例中,访问端口为 295,读取端口为 296。在本节的进一步阅读中,有一个环境控制器寄存器表。在这种情况下,CPU 温度在寄存器 2Ah(或 0x2A)中。因此,我用来提取信息的 VB/C# 代码如下所示:

Private Function GetCPUTemp() As UInt32
    Dim tCpu As UInt32
    Dim stCpu As Short
    PortAccess.Outputb(&H295, &H2A)
    stCpu = PortAccess.Inputb(&H296)
    tCpu = CType(stCpu, UInt32)
    Return tCpu
End Function

现在,你只需要弄清楚你想用它做什么。记住,如果你发现你得到了疯狂的古怪数字,你要么从错误的寄存器中提取,要么你可能需要实现一个比例因子(就像你对电压读数所做的那样)。这也应该在数据表中。

于 2012-04-03T13:53:14.310 回答
0

我会推荐以下方法。有几个免费的应用程序可以监控 CPU 温度并显示它。尝试下载一些,然后分析应用程序以查看它们调用了哪些方法,以了解它们是如何工作的。也许他们对您现有的方法有非常不同的方法。你也可以给他们发邮件问问他们是怎么做到的......

http://www.alcpu.com/CoreTemp/

http://www.techpowerup.com/realtemp/

http://malektips.com/core-temp-cpu-windows-system-tray-taskbar.html

于 2010-09-03T00:34:31.647 回答