那位好心人高人帮忙发个vb获取cpu核心温度的代码!小弟谢了!

2024-11-30 16:53:35
推荐回答(3个)
回答1:

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

回答2:

Public Function GetCPUTemp() As Double
Dim i As Integer
Dim mCPU As Variant
Dim u As Variant
Dim s As String

Set mCPU = GetObject(

回答3:

是被关闭了。。。
2毛博客
详细哦