如何在c / c ++ / vb.net/c#中获得cpu温度?

时间:2021-05-15 03:21:22

How can I get the cpu temperature using c/c++/vb.net/c# ? I already found this link Get CPU Temperature in .Net, but I'm not sure if it really works.

如何使用c / c ++ / vb.net/c#获取cpu温度?我已经在.Net中找到了这个链接获取CPU温度,但我不确定它是否真的有效。

Also I would like to know if there is a way other than using wmi queries.

另外我想知道除了使用wmi查询之外还有其他方法。

2 个解决方案

#1


1  

It can be done in your code via WMI. I've found a tool from Microsoft that creates code for it.

它可以通过WMI在您的代码中完成。我找到了Microsoft的一个工具,可以为它创建代码。

The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.

WMI Code Creator工具允许您生成VBScript,C#和VB .NET代码,这些代码使用WMI完成管理任务,例如查询管理数据,从WMI类执行方法或使用WMI接收事件通知。

You can download it here.

你可以在这里下载。

#2


0  

It does not appear possible to use the Win32_TemperatureProbe wmi class, at least when I query it I get nothing back, and this appears to be common.

似乎不可能使用Win32_TemperatureProbe wmi类,至少当我查询它时我什么也得不回来,这看起来很常见。

I found this custom c# driver someone wrote for retrieving the information:

我找到了这个用于检索信息的自定义c#驱动程序:

http://temperature.myweb.hinet.net/index_en.htm

It includes the source code.

它包括源代码。

#1


1  

It can be done in your code via WMI. I've found a tool from Microsoft that creates code for it.

它可以通过WMI在您的代码中完成。我找到了Microsoft的一个工具,可以为它创建代码。

The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.

WMI Code Creator工具允许您生成VBScript,C#和VB .NET代码,这些代码使用WMI完成管理任务,例如查询管理数据,从WMI类执行方法或使用WMI接收事件通知。

You can download it here.

你可以在这里下载。

#2


0  

It does not appear possible to use the Win32_TemperatureProbe wmi class, at least when I query it I get nothing back, and this appears to be common.

似乎不可能使用Win32_TemperatureProbe wmi类,至少当我查询它时我什么也得不回来,这看起来很常见。

I found this custom c# driver someone wrote for retrieving the information:

我找到了这个用于检索信息的自定义c#驱动程序:

http://temperature.myweb.hinet.net/index_en.htm

It includes the source code.

它包括源代码。