本人通過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
是不是這個wmi數據沒有刷新。