473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

CPU Temperature

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
5 32402
"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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Derek Ross | last post by:
Hello, Say I have a server that's saving the CPU temperature to 'temperature.js' once a second. The contents of the file is one single line: var temperature = "35.5"; And it changes as...
1
by: Tom | last post by:
Hi guys, I'm trying to read the cpu temperature.. and I've been playing with WMI for a few days could not get it to work :( if I continue anymore I think I'll be bald very soon :P so any crumbs...
1
by: deanfamily11 | last post by:
I'm trying to have this program do a simple temperature conversion from Fahrenheit to Celsius. I have confirmed that the other variable is receiving and calculating the conversion, but it is just...
1
by: pollardw | last post by:
i have written a small program to convert Fahrenheit to Celsius and I have a minor problem. Here is the code what do i need to change to get it to work? /* Convert Fahrenheit to Celsius */ ...
4
by: arnuld | last post by:
this is my final code. Can you folks advise some improvements for making this programme better? BTW, i aways compile my programme with this cmmand on Linux: g++ -ansi -pedantic -Wall -Wextra...
21
by: AsheeG87 | last post by:
Hey Everyone~ I'm still a C++ Rookie so please bear with me on this. I'm doing a temperature conversion program with prototype functions. Basicly, I was wondering if some of you would take a look...
16
by: Brigitte Behrmann | last post by:
I am absolutely stuck with this one. I have to create a temperature conversion calculator that rounds the resulting temperature to the nearest whole number & vice versa. The result must be displayed...
25
by: kid joe | last post by:
Hi, Is it normal for the temperature of your CPU to increase as time goes on? I've got an Athlon XP 2100+ and I see that the temp is now at 51C where it used to be around 42 to 44. Anyone...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.