使用C#的CPU温度 [英] CPU Temperature using C#

查看:82
本文介绍了使用C#的CPU温度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我用C#获取处理器温度。

我尝试使用,



Please help me to get processor temperature using C#.
I tried using,

using System.Management;
using OpenHardwareMonitor.Hardware;







但是,根本没有成功。请给我一个有效的来源来完成我的目标。

任何帮助将不胜感激。



再次感谢你...




but, weren't success at all. Please provide me a valid source to accomplish my target.
Any help would be greatly appreciated.

Thank you again...

推荐答案

你不一定能得到它:它依赖于你的硬件制造商而且它不一定是通过WMI提供的,如果有的话。如果硬件支持它,则可能是BIOS特定的访问方法。这段代码可能会这样做,但它可能会给出不支持的例外:

You can't necessarily get it: it's dependant on the manufacturer of your hardware and it isn't necessarily available via WMI, if at all. If the hardware supports it, the chances are it's a BIOS specific access method. This code may do it, but it will probably give "not supported" exceptions:
ManagementObjectSearcher mos = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature");
foreach (ManagementObject mo in mos.Get())
    {
    Double temp = Convert.ToDouble(mo["CurrentTemperature"].ToString());
    temp = (temp - 2732) / 10.0;
    Console.WriteLine("{0}, {1}", temp, mo["InstanceName"]);
    }


这篇关于使用C#的CPU温度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆