Hack Forums
[.NET] CPU Temp - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] CPU Temp (/showthread.php?tid=3713040)



CPU Temp - Moon Rock - Aug 24, 2013

I've been putting codes together to make a TaskManager so far it has processes and process kill CPU + RAM Usage, but I want to add a temperature label. I've tried different codes, but there not working. I heard you have to run it in Win Xp I did but still nothing I want to make it a label that refreshes in a timer, so can anyone tell/link me something that can help me thanks for using your time to read this.


* - Grieveā„¢ - Aug 24, 2013

This source has CPU temperature along with other pc stuff: https://hackforums.net/showthread.php?tid=3700586


* - BlackFiber - Aug 24, 2013

Code
Function GetTemp() As String
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
  return temp.tostring()
    Next
  Catch ex As ManagementException
    MessageBox.Show(ex.Message)
return nothing
  End Try
End Function



* - Moon Rock - Aug 25, 2013

Thanks guys got it down and it works