vbr666
asked on
Extracting CPUs temperature and coolers RPM
Is there a way to show CPUs temperature and coolers RPM value in VB? In my bios hardware monitor both values are shown and I want to extract them somehow to VB. Any ideas or suggestions? Please help.
ASKER
How do I use that class? Where to download it? I dont understand what I need to do to read a temp. Can you give an example?
ASKER
Im sorry but i cant use that code because i dont have vb.net and i cant add a listview to a form. Do you know example for "regular" VB?
That code is for VB 6, not .NET from the article:
Applies to: VB5, VB6
Read the info provided in the link.
You probably need to put a listview into your toolbox (which is why you don't see it available)
You don't need the listbox for it to work, though.
Public Sub GetInfo()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject 'CurrentProbe
On Local Error Resume Next
Set wmiObjSet = GetObject("winmgmts:{imper sonationLe vel=impers onate}"). _
InstancesOf("Win32_Tempera tureProbe" )
Dim strOutput As String
For Each obj In wmiObjSet
strOutput = strOutput & CStr(obj.Description) & vbTab
strOutput = strOutput & CStr(obj.Name) & vbTab
strOutput = strOutput & CStr(obj.DeviceID) & vbTab
strOutput = strOutput & CStr(obj.Resolution) & vbTab
strOutput = strOutput & CStr(obj.Tolerance) & vbTab
strOutput = strOutput & obj.Accuracy / obj.Resolution / obj.Tolerance & " %"
Next
MsgBox strOutput
End Sub
As the article explains, on some systems you may not be able to get certain info.
Applies to: VB5, VB6
Read the info provided in the link.
You probably need to put a listview into your toolbox (which is why you don't see it available)
You don't need the listbox for it to work, though.
Public Sub GetInfo()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject 'CurrentProbe
On Local Error Resume Next
Set wmiObjSet = GetObject("winmgmts:{imper
InstancesOf("Win32_Tempera
Dim strOutput As String
For Each obj In wmiObjSet
strOutput = strOutput & CStr(obj.Description) & vbTab
strOutput = strOutput & CStr(obj.Name) & vbTab
strOutput = strOutput & CStr(obj.DeviceID) & vbTab
strOutput = strOutput & CStr(obj.Resolution) & vbTab
strOutput = strOutput & CStr(obj.Tolerance) & vbTab
strOutput = strOutput & obj.Accuracy / obj.Resolution / obj.Tolerance & " %"
Next
MsgBox strOutput
End Sub
As the article explains, on some systems you may not be able to get certain info.
ASKER
Ok i found a listview and added it and command1 to the form and I copied that code from the link above and added a reference for"Microsoft WMI Scripting v1.2 library" to vb6 and when I started prog and tried to click on a button nothing happened! All fields in listview were blank. What for is that code in your last reply? I copied code from the link you gave me: http://vbnet.mvps.org/index.html?code/wmi/wmitemperatureprobe.htm
Have you tried using that code from this link? Why doesnt it work?
Have you tried using that code from this link? Why doesnt it work?
It might be the way your system is configured. The author of the article explains that. The code above was so you didn't need a listview.
Discofish
Discofish
ASKER
The code wont work on both my computers. The temperature probe is installed in my system im certain and in bios I can normally read temperature but why cant I read it in vb? What could be wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might be able to to use the temperatureproble class in Windows Management Instrumentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_temperatureprobe.asp
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_start_page.asp
There might also be vendor specific API's for your particular board if the above method doesn't work for you.