RE: Getting CPU Temperature 07-13-2013, 12:56 PM
#11
(07-13-2013, 12:43 PM)Madara-Uchiha Wrote: You can do it using WMI.
Parse this code into your application, and make sure you've set a reference to System.Management.
PHP Code:Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim searcher As New ManagementObjectSearcher("root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature")
For Each queryObj As ManagementObject In searcher.Get()
Dim temp As Double = CDbl(queryObj("CurrentTemperature"))
temp = (temp - 2732) / 10.0
MessageBox.Show(temp.ToString + "°C")
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Sub
End Class
Then start it as administrator and it will look like this:
Also, a Problem with that is if you have Visual Studio you can't set the Reference to that. Most people don't use it doe. : )
![[Image: xlbdwZT.png]](http://i.imgur.com/xlbdwZT.png)