本人通过VB编程从WMI获取CPU温度,但却是静止不动的,有高手说是必须在某些系统信息发生改变时才会刷新数据。但打开SPEEDFAN温度检测后,WMI里的CPU温度数据却动态地刷新着。并且是准确地。所以在这请教高手解释这里面的原因。
附上VB代码
Private Sub Command1_Click()
MsgBox "CPU 溫度 : " & CPU_Temperature & " °C"
End Sub
Private Function CPU_Temperature() As Integer
Dim WMIsvc As Object
Dim CltItems As Object, CltItem As Object
Dim Q As String
Set WMIsvc = GetObject("winmgmts:\\.\root\WMI")
Q = "SELECT * FROM MSAcpi_ThermalZoneTemperature"
Set CltItems = WMIsvc.ExecQuery(Q, , 48)
For Each CltItem In CltItems
CPU_Temperature = CltItem.CurrentTemperature
Next
CPU_Temperature = (CPU_Temperature - 2732) / 10
Set CltItem = Nothing
Set CltItems = Nothing
Set WMIsvc = Nothing
End Function