Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Extracting CPUs temperature and coolers RPM

Posted on 2004-08-15
9
571 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:vbr666
  • 5
  • 4
9 Comments
 
LVL 2

Expert Comment

by:Discofish
ID: 11804176

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.
0
 

Author Comment

by:vbr666
ID: 11804416
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?
0
 
LVL 2

Expert Comment

by:Discofish
ID: 11805394
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:vbr666
ID: 11805605
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?
0
 
LVL 2

Expert Comment

by:Discofish
ID: 11805836
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:{impersonationLevel=impersonate}"). _
                              InstancesOf("Win32_TemperatureProbe")
   
    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.
0
 

Author Comment

by:vbr666
ID: 11808705
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?
0
 
LVL 2

Expert Comment

by:Discofish
ID: 11825244
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
0
 

Author Comment

by:vbr666
ID: 11825449
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?
0
 
LVL 2

Accepted Solution

by:
Discofish earned 187 total points
ID: 11836824
Hmmm, sorry I don't think I can help.

I have an ASUS MB, and it comes with some DLLS  with functions for getting temperature, fan speed, etc.

If you get a program called PE Explorer (free trial, there may be a fre one out there) you can take a look at all the functions in a dll (Params and return values).  Then the tricky part will be getting it to work in VB.  

You use a DLL function in the following way

public declare function GooFoo Lib "Foobar.dll" Alias "GooFooA" (ByRef Goo As Long,ByRef Foo As long) As Long

There is a bunch of good info about this on the web, so try doing a google search.

Discofish
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA to copy paste columns form one file to other 20 90
using Access 8 75
Send outlook email from VBS Script 2 42
MS SQL Update query with connected table data 3 34
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question