Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
' -------------
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Dim wbemServices As Object
Dim wbemObject As Object
Dim wbemObjectSet As Object
Dim wbemCounter As Integer
Dim stemp As Single
Set dbsinfo = OpenDatabase("cputemp.mdb")
Set rstinfo = dbsinfo.OpenRecordset("computerinfo", dbOpenDynaset)
Set wbemServices = GetObject("winmgmts:" & "\\localhost\root\wmi")
Set wbemObjectSet = wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature")
' temp = 123.45
compname = GetEnvironmentVar("USERDOMAIN")
rstinfo.FindFirst rstinfo(0).Name & " = '" & compname & "'"
ret = rstinfo(3)
' If rstinfo.NoMatch Then Stop
For Each wbemObject In wbemObjectSet
rstinfo.Edit
' temp = wbemObject.CurrentTemperature
stemp = (wbemObject.CurrentTemperature - 2732) / 10
rstinfo(1) = Time: rstinfo(2) = stemp
rstinfo.Update
Next
Set dbsinfo = Nothing
Set rstinfo = Nothing
Set wbemServices = Nothing
Set wbemObjectSet = Nothing
Debug.Print Time, stemp
''' Ret = GetPressedKey
''' If Ret <> sOld Then
''' sOld = Ret
''' sSave = sSave + sOld
''' End If
Exit Sub
error_h:
KillTimer ret, 0
End Sub