Public Function GetCPUTemp() As Double
Dim i As Integer = 0
Dim mCPU As Object
Dim u As Object
Dim s As String = String.Empty
mCPU = GetObject("WINMGMTS:{impersonationLevel=impersonate}!root\wmi").ExecQuery("SELECT CurrentTemperature From MSAcpi_ThermalZoneTemperature")
For Each u In mCPU
s = s & u.CurrentTemperature
Next
mCPU = Nothing
GetCPUTemp = (s - 2732) / 10
End Function
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
Dim cputemputure As Long = GetCPUTemp()
If cputemputure >= 80 Then
Me.Label3.ForeColor = Color.Red
Me.Label3.Text = "CPU的实时温度 " & cputemputure
ElseIf cputemputure >= 40 And cputemputure < 80 Then
Me.Label3.ForeColor = Color.Yellow
Me.Label3.Text = "CPU的实时温度 " & cputemputure
Else
Me.Label3.ForeColor = Color.Green
Me.Label3.Text = "CPU的实时温度 " & cputemputure
End If
End Sub
是这样重新获取吗
@Nukepayload2