RE: Getting CPU Temperature - Blue - 07-13-2013
(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:
![[Image: 3qmh7dfz.png]](http://s7.directupload.net/images/130713/3qmh7dfz.png)
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. : )
RE: Getting CPU Temperature - Hexology - 07-13-2013
(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:
![[Image: 3qmh7dfz.png]](http://s7.directupload.net/images/130713/3qmh7dfz.png)
Wrong, First of all I've noticed all of that code is C&P'ed from here, so give propper credits. Secondly that won't fix my error? I've already coded it and I'm having trouble with the call back, and I set the application to <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> in the app manifest.
RE: Getting CPU Temperature - Madara-Uchiha - 07-13-2013
@Hexology: Genius! I've never said that this is my code.
You can find the solution yourself by doing a quick google search.
RE: Getting CPU Temperature - Hexology - 07-13-2013
(07-13-2013, 01:30 PM)Madara-Uchiha Wrote: @Hexology: Genius! I've never said that this is my code.
You can find the solution yourself by doing a quick google search.
I'm not quite sure you understand the error, the motherboard DOESN'T allow callbacks from WMI. I've been googling it, trust me, I can't find an answer anywhere. And you should ALWAYS give credits if you post someone else's code. Sorry if I'm being stern I just don't like it when people do that.
RE: Getting CPU Temperature - Blue - 07-13-2013
(07-13-2013, 01:35 PM)Hexology Wrote: (07-13-2013, 01:30 PM)Madara-Uchiha Wrote: @Hexology: Genius! I've never said that this is my code.
You can find the solution yourself by doing a quick google search.
I'm not quite sure you understand the error, the motherboard DOESN'T allow callbacks from WMI. I've been googling it, trust me, I can't find an answer anywhere. And you should ALWAYS give credits if you post someone else's code. Sorry if I'm being stern I just don't like it when people do that.
Amen. Hm, Here if you just want a program to check it!
http://dl.installiq.com/download/downloadpop.aspx?shortname=coretemp&a=13307&f=CoreTemp
RE: Getting CPU Temperature - Hexology - 07-13-2013
(07-13-2013, 02:02 PM)Blue Wrote: (07-13-2013, 01:35 PM)Hexology Wrote: (07-13-2013, 01:30 PM)Madara-Uchiha Wrote: @Hexology: Genius! I've never said that this is my code.
You can find the solution yourself by doing a quick google search.
I'm not quite sure you understand the error, the motherboard DOESN'T allow callbacks from WMI. I've been googling it, trust me, I can't find an answer anywhere. And you should ALWAYS give credits if you post someone else's code. Sorry if I'm being stern I just don't like it when people do that.
Amen. Hm, Here if you just want a program to check it!
http://dl.installiq.com/download/downloadpop.aspx?shortname=coretemp&a=13307&f=CoreTemp
Thanks, I'm going to need to take a look at a lot of PC Optamizers because I'm trying to make one It'll be my next project!
RE: Getting CPU Temperature - Blue - 07-13-2013
(07-13-2013, 02:29 PM)Hexology Wrote: (07-13-2013, 02:02 PM)Blue Wrote: (07-13-2013, 01:35 PM)Hexology Wrote: (07-13-2013, 01:30 PM)Madara-Uchiha Wrote: @Hexology: Genius! I've never said that this is my code.
You can find the solution yourself by doing a quick google search.
I'm not quite sure you understand the error, the motherboard DOESN'T allow callbacks from WMI. I've been googling it, trust me, I can't find an answer anywhere. And you should ALWAYS give credits if you post someone else's code. Sorry if I'm being stern I just don't like it when people do that.
Amen. Hm, Here if you just want a program to check it!
http://dl.installiq.com/download/downloadpop.aspx?shortname=coretemp&a=13307&f=CoreTemp
Thanks, I'm going to need to take a look at a lot of PC Optamizers because I'm trying to make one It'll be my next project!
Sounds good! I made a simple CPU meter a while back.
|