如何使用 C# 从 BIOS 获取 CPU 温度信息?
如何使用 C# 从 Bios 获取 CPU 温度信息 我尝试了CPU温度监控中的代码
,但没有运气。 “enumerator.Current”引发异常。
我怎样才能做到这一点?谢谢。
错误 :
“该系统不支持 所需的 WMI 对象(1) - 检查 异常文件 \r\n不支持 \r\n\r\n 位于 System.Management.ManagementException.ThrowWithExtendedInfo(管理状态 错误代码)\r\n 位于 System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()\r\n 在 CedarLogic.WmiLib.SystemStatistics.RefreshReadings() 在 D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\WmiLib\SystemStatistics.cs:行 25\r\n 于 CedarLogic.WmiLib.SystemStatistics.get_CurrentTemperature() 在 D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\WmiLib\SystemStatistics.cs:行 87\r\n 在 TemperatureMonitor.SystemTrayService.CheckSupport() 在 D:\Downloads\TempMonitorSrc\TemperatureMonitorSln\TemperatureMonitor\SystemTrayService.cs:行 260"
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"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会推荐以下方法。有几个免费应用程序可以监视 CPU 温度并显示它。尝试下载一些应用程序,然后分析应用程序以查看它们正在调用哪些方法,从而了解它们的工作原理。也许他们的方法与您现有的方法非常不同。您也可以给他们发电子邮件并询问他们是如何做到的...
http://www.alcpu .com/CoreTemp/
http://www.techpowerup.com/realtemp/
http://malektips.com/core-temp-cpu- windows-system-tray-taskbar.html
I would recommend the following approach. There are several free applications that monitor the CPU temp and display it. Try downloading some and then analyse the application to see what methods they are calling in order to discover how they work. Maybe they have a very different approach to your existing one. Also you might be able to just email them and ask how they did it...
http://www.alcpu.com/CoreTemp/
http://www.techpowerup.com/realtemp/
http://malektips.com/core-temp-cpu-windows-system-tray-taskbar.html
您需要支持许多不同的硬件传感器来收集温度数据。更好的方法是采用如下所示的现成可用解决方案:
1) 开放硬件监视器 - 开源 .NET 2.0 应用程序:
http:// openhardwaremonitor.org/
2) Core Temp - 免费应用程序和 .NET API,用于获取温度数据:
http://www.alcpu.com/CoreTemp/developers.html
You need to support many diffrent hardware sensors to gather temperature data. Better way is to take ready to use solutions like these:
1) Open Hardware Monitor - open source .NET 2.0 Application:
http://openhardwaremonitor.org/
2) Core Temp - free application and .NET API to get temperature data:
http:// www.alcpu.com/CoreTemp/developers.html
我知道这个线程很旧,但我想用一些不同的方法来添加它。获取主板上 I/O 芯片的品牌/型号,并获取所述 I/O 芯片的数据表(我将使用 ITE IT8783F 芯片作为参考)。
查看环境控制器之类的内容并计算访问和读取端口。是的...您将必须了解HEX、MSB和LSB,我不会在这里进行计算/解释(超出范围)。
现在,在本例中,访问端口为 295,读取端口为 296。在本节中进一步阅读,有一个环境控制器寄存器表。在本例中,CPU 温度位于寄存器 2Ah(或 0x2A)中。因此,我用来提取信息的 VB/C# 代码如下所示:
现在,您只需弄清楚您想用它做什么。请记住,如果您发现得到了疯狂古怪的数字,那么您要么从错误的寄存器中提取数据,要么可能需要实现缩放因子(就像处理电压读数一样)。这也应该在数据表中。
I know this thread is old, but I wanted to add to it with a bit of a different approach. Get the make/model off the I/O chip on the motherboard and get the data sheet for said I/O chip (I will use an ITE IT8783F chip for reference here).
Look under something like Environment Controller and calculate the access and read ports. Yes ... you will have to understand HEX and MSB and LSB and I won't go into the calculations/explanation here (out of scope).
Now, in this instance the access port is 295 and the read port is 296. Reading further down in the section there is a table for the Environment Controller Registers. In this instance, the CPU temperature is in register 2Ah (or 0x2A). So, the VB/C# code I used to pull the info looks like this:
Now, you just have to figure out what you want to do with it. Remember, if you find that you are getting crazy wacky numbers, you either are pulling from the wrong register or you may need to implement a scaling factor (as you do with voltage readings). This, too, should be in the data sheet.