By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

CPU Temperature

P: n/a
One the computer I am programmig I could see the CPU temperature in the
BIOS, is there a system DLL in VB.NET that I can call to display the
temperature in my software?

Thanks!
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"anthony" <an*******@controlengineer.com> schrieb:
One the computer I am programmig I could see the CPU temperature in the
BIOS, is there a system DLL in VB.NET that I can call to display the
temperature in my software?


<URL:http://www.google.es/groups?q=Win32_TemperatureProbe+dotnet+-herfried>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2

P: n/a
Anthony,

You can use WMI if your hardware is compliant. Use the wbemtest.exe
utility to confirm whether or not you can even retrieve the
temperature. There are two ways I know of to retrieve the temperature
information.

1) Using wbemtest.exe connect to the namespace "root\cimv2" (without
quotes). Click the Query button and enter "select * from
Win32_TemperatureProbe". Double click on any result you get back and
look for the CurrentReading property in the properties section. The
value you see there should be the temperature. If it just shows
"<null>" then this option will not work.

2) Using wbemtest.ext connect to the namespace "root\WMI". Enter the
query "select * from MSAcpi_ThermalZoneTemperature". Double click on
any result you get back and look for the CurrentTemperature property.
The value is in tenths of degrees Kelvin.

Using #2 I can see that I have 3 temperature probes in my laptop. I
can view their values in .NET using the following code. I apologize in
advance for using C# in VB forum.

// Reference the System.Management.dll assembly first.
using System.Management;

public class Temperature
{
public static void Main()
{
string scope = @"root\WMI";
string query = @"select * from MSAcpi_ThermalZoneTemperature";

ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query);

foreach (ManagementObject obj in searcher.Get())
{
Console.WriteLine(obj.Properties["CurrentTemperature"].Value);
}
}
}

Brian

anthony wrote:
One the computer I am programmig I could see the CPU temperature in
the BIOS, is there a system DLL in VB.NET that I can call to
display the temperature in my software?

Thanks!


Nov 21 '05 #3

P: n/a
Thanks,

I am able to use the following VB.NET code to get the temperature in my
development machine, but when I run in a XP Embedded machine, I got
"Provider Load Failure" error message for the first button, and "Invalid
parameter" for the second one. Any idea? Thanks for your knowledge!

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\cimv2", "Select *
from Win32_TemperatureProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentReading")

Next

MsgBox(StrOutput)

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\WMI", "Select *
from MSAcpi_ThermalZoneTemperature")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToString(Convert.ToUInt32(mo("CurrentTempe rature")))

Next

MsgBox(StrOutput)

End Sub

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ei**************@TK2MSFTNGP15.phx.gbl...
"anthony" <an*******@controlengineer.com> schrieb:
One the computer I am programmig I could see the CPU temperature in the
BIOS, is there a system DLL in VB.NET that I can call to display the
temperature in my software?

<URL:http://www.google.es/groups?q=Win32_TemperatureProbe+dotnet+-herfried>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
I am able to use the following VB.NET code to get the temperature in my
development machine, but when I run in a XP Embedded machine, I got
"Provider Load Failure" error message for the first button, and "Invalid
parameter" for the second one. Any idea? Thanks for your knowledge!

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\cimv2", "Select *
from Win32_TemperatureProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentReading")

Next

MsgBox(StrOutput)

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\WMI", "Select *
from MSAcpi_ThermalZoneTemperature")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToString(Convert.ToUInt32(mo("CurrentTempe rature")))

Next

MsgBox(StrOutput)

End Sub

"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Anthony,

You can use WMI if your hardware is compliant. Use the wbemtest.exe
utility to confirm whether or not you can even retrieve the
temperature. There are two ways I know of to retrieve the temperature
information.

1) Using wbemtest.exe connect to the namespace "root\cimv2" (without
quotes). Click the Query button and enter "select * from
Win32_TemperatureProbe". Double click on any result you get back and
look for the CurrentReading property in the properties section. The
value you see there should be the temperature. If it just shows
"<null>" then this option will not work.

2) Using wbemtest.ext connect to the namespace "root\WMI". Enter the
query "select * from MSAcpi_ThermalZoneTemperature". Double click on
any result you get back and look for the CurrentTemperature property.
The value is in tenths of degrees Kelvin.

Using #2 I can see that I have 3 temperature probes in my laptop. I
can view their values in .NET using the following code. I apologize in
advance for using C# in VB forum.

// Reference the System.Management.dll assembly first.
using System.Management;

public class Temperature
{
public static void Main()
{
string scope = @"root\WMI";
string query = @"select * from MSAcpi_ThermalZoneTemperature";

ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query);

foreach (ManagementObject obj in searcher.Get())
{
Console.WriteLine(obj.Properties["CurrentTemperature"].Value);
}
}
}

Brian

anthony wrote:
One the computer I am programmig I could see the CPU temperature in
the BIOS, is there a system DLL in VB.NET that I can call to
display the temperature in my software?

Thanks!

Nov 21 '05 #5

P: n/a
Hi,

When you look at the supported operating systems for
win32_temperatureprobe I see windows xp. I do not see xp embedded.

http://msdn.microsoft.com/library/de...atureprobe.asp
Ken
------------------
"anthony" <an*******@controlengineer.com> wrote in message
news:OO**************@TK2MSFTNGP09.phx.gbl...
I am able to use the following VB.NET code to get the temperature in my
development machine, but when I run in a XP Embedded machine, I got
"Provider Load Failure" error message for the first button, and "Invalid
parameter" for the second one. Any idea? Thanks for your knowledge!

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\cimv2", "Select *
from Win32_TemperatureProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentReading")

Next

MsgBox(StrOutput)

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

Dim StrOutput As String

moSearch = New Management.ManagementObjectSearcher("root\WMI", "Select *
from MSAcpi_ThermalZoneTemperature")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToString(Convert.ToUInt32(mo("CurrentTempe rature")))

Next

MsgBox(StrOutput)

End Sub

"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Anthony,

You can use WMI if your hardware is compliant. Use the wbemtest.exe
utility to confirm whether or not you can even retrieve the
temperature. There are two ways I know of to retrieve the temperature
information.

1) Using wbemtest.exe connect to the namespace "root\cimv2" (without
quotes). Click the Query button and enter "select * from
Win32_TemperatureProbe". Double click on any result you get back and
look for the CurrentReading property in the properties section. The
value you see there should be the temperature. If it just shows
"<null>" then this option will not work.

2) Using wbemtest.ext connect to the namespace "root\WMI". Enter the
query "select * from MSAcpi_ThermalZoneTemperature". Double click on
any result you get back and look for the CurrentTemperature property.
The value is in tenths of degrees Kelvin.

Using #2 I can see that I have 3 temperature probes in my laptop. I
can view their values in .NET using the following code. I apologize in
advance for using C# in VB forum.

// Reference the System.Management.dll assembly first.
using System.Management;

public class Temperature
{
public static void Main()
{
string scope = @"root\WMI";
string query = @"select * from MSAcpi_ThermalZoneTemperature";

ManagementObjectSearcher searcher = new
ManagementObjectSearcher(scope, query);

foreach (ManagementObject obj in searcher.Get())
{
Console.WriteLine(obj.Properties["CurrentTemperature"].Value);
}
}
}

Brian

anthony wrote:
One the computer I am programmig I could see the CPU temperature in
the BIOS, is there a system DLL in VB.NET that I can call to
display the temperature in my software?

Thanks!


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.