Tag: VB CPU 温度
'添加一个Timer Interval 值设为100 '添加一个Label 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 Timer1_Timer() Label1.Caption = "当前CPU的温度为:" & GetCPUTemp() & "℃" End Sub