VB 如何得到CPU温度呢?
发布网友
发布时间:2022-09-14 18:36
我来回答
共2个回答
热心网友
时间:2024-11-16 11:45
Public Function GetCPUTemp() As Double
Dim i As Integer
Dim mCPU As Variant
Dim u As Variant
Dim s As String
Set mCPU = GetObject("WINMGMTS:{impersonationLevel=impersonate}!root\wmi").ExecQuery("SELECT CurrentTemperature From MSAcpi_ThermalZoneTemperature")
For Each u In mCPU
s = s & u.CurrentTemperature
Next
Set mCPU = Nothing
GetCPUTemp = (s - 2732) / 10
End Function
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Print GetCPUTemp()
End Sub
热心网友
时间:2024-11-16 11:45
微软的MVP说到了,如果主板提供了API并注册到了系统WMI下,那就可以在.Net下调用,从而读取CPU的温度信息.否则的话,就无法通过简单的方法来实现CPU温度的读取.更何况有些主板根本就不有温度探头,没有办法的。