473,567 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 32451
"anthony" <an*******@cont rolengineer.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_ TemperatureProb e+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_Temperatu reProbe". 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_ThermalZ oneTemperature" . Double click on
any result you get back and look for the CurrentTemperat ure 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.Manageme nt.dll assembly first.
using System.Manageme nt;

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

ManagementObjec tSearcher searcher = new
ManagementObjec tSearcher(scope , query);

foreach (ManagementObje ct obj in searcher.Get())
{
Console.WriteLi ne(obj.Properti es["CurrentTempera ture"].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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\cim v2", "Select *
from Win32_Temperatu reProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentRead ing")

Next

MsgBox(StrOutpu t)

End Sub

Private Sub Button5_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button5.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\WMI ", "Select *
from MSAcpi_ThermalZ oneTemperature" )

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToStrin g(Convert.ToUIn t32(mo("Current Temperature")))

Next

MsgBox(StrOutpu t)

End Sub

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ei******** ******@TK2MSFTN GP15.phx.gbl...
"anthony" <an*******@cont rolengineer.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_ TemperatureProb e+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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\cim v2", "Select *
from Win32_Temperatu reProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentRead ing")

Next

MsgBox(StrOutpu t)

End Sub

Private Sub Button5_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button5.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\WMI ", "Select *
from MSAcpi_ThermalZ oneTemperature" )

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToStrin g(Convert.ToUIn t32(mo("Current Temperature")))

Next

MsgBox(StrOutpu t)

End Sub

"Brian Gideon" <br*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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_Temperatu reProbe". 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_ThermalZ oneTemperature" . Double click on
any result you get back and look for the CurrentTemperat ure 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.Manageme nt.dll assembly first.
using System.Manageme nt;

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

ManagementObjec tSearcher searcher = new
ManagementObjec tSearcher(scope , query);

foreach (ManagementObje ct obj in searcher.Get())
{
Console.WriteLi ne(obj.Properti es["CurrentTempera ture"].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_temperatu reprobe I see windows xp. I do not see xp embedded.

http://msdn.microsoft.com/library/de...atureprobe.asp
Ken
------------------
"anthony" <an*******@cont rolengineer.com > wrote in message
news:OO******** ******@TK2MSFTN GP09.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\cim v2", "Select *
from Win32_Temperatu reProbe")

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " & mo("Name") & " " & mo("CurrentRead ing")

Next

MsgBox(StrOutpu t)

End Sub

Private Sub Button5_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button5.Click

Dim moReturn As Management.Mana gementObjectCol lection

Dim moSearch As Management.Mana gementObjectSea rcher

Dim mo As Management.Mana gementObject

Dim StrOutput As String

moSearch = New Management.Mana gementObjectSea rcher("root\WMI ", "Select *
from MSAcpi_ThermalZ oneTemperature" )

moReturn = moSearch.Get

For Each mo In moReturn

StrOutput = StrOutput & " " &
Convert.ToStrin g(Convert.ToUIn t32(mo("Current Temperature")))

Next

MsgBox(StrOutpu t)

End Sub

"Brian Gideon" <br*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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_Temperatu reProbe". 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_ThermalZ oneTemperature" . Double click on
any result you get back and look for the CurrentTemperat ure 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.Manageme nt.dll assembly first.
using System.Manageme nt;

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

ManagementObjec tSearcher searcher = new
ManagementObjec tSearcher(scope , query);

foreach (ManagementObje ct obj in searcher.Get())
{
Console.WriteLi ne(obj.Properti es["CurrentTempera ture"].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
7815
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 the temperature changes.
1
8137
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 of wisdom would be highly appreciated !. atm I'm getting no output from this. not sure why... it seems the case from all hardware win32.. very...
1
12124
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 outputting as "0". Any thoughts? (Code is below) #include <iostream> #include <iomanip> using namespace std;
1
3192
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 */ #include <iostream> #include <iomanip> #include <string>
4
2334
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 file.cpp // a programme that converts Fahrenheit temperature // to Celcius (in range 0 -
21
4249
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 at my code and critique it for me. I'm mostly concerned with how prototype functions work and if I designed them correctly in my code. Your...
16
4411
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 in a window alert. The given formula is (Fahrenheit_temp - 32) * .55 The only tip/clue I have is to use var tempInCelcius =...
25
4867
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 have any ideas?
0
7905
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8115
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6272
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5488
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5216
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3648
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
930
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.