Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 2nd, 2008, 2:53 PM   #1
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 189
Rep Power: 1 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Temperature Controls

Hi,

I'm wanting to make a temperature monitoring application like speedfan or coretemp and was just wondering how to monitor the temperature. Is there a certain control - I've tried googling for a class or something and I just can't find anything.

Thanks very, very much!

Matt. I
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jan 2nd, 2008, 11:47 PM   #2
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: olympia,WA
Posts: 329
Rep Power: 3 mrynit is on a distinguished road
Send a message via AIM to mrynit Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
Re: Temperature Controls

do you actualy want to interface with hardware?
__________________
i dont know much about programming but i try to help
mrynit is offline   Reply With Quote
Old Jan 3rd, 2008, 3:57 AM   #3
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 189
Rep Power: 1 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Re: Temperature Controls

Yes, I think it would be nice. Why would you not recommend it? Is there something bad I'm missing?

Thanks for the reply!
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jan 6th, 2008, 7:19 AM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,722
Rep Power: 5 Sane is on a distinguished road
Re: Temperature Controls

Here's a link to a discussion about how to do it in Linux. Although you're not doing this in Linux, I'm sure that either some of the libraries are cross-compatible and/or you can use this thread as a stepping stone to finding the correct library.

Good luck.
Sane is offline   Reply With Quote
Old Jan 6th, 2008, 9:53 AM   #5
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 45
Rep Power: 0 milot is on a distinguished road
Re: Temperature Controls

You can use WMI (Windows Management Instrumentation) Classes and use the Win32_TemperatureProbe WMI Class to get that information you need, here is a code snippet that shows how to use WMI on C#, you can easily convert this to VB:

the code:

csharp Syntax (Toggle Plain Text)
  1. using System;
  2. using System.Management;
  3. using System.Management.Instrumentation;
  4.  
  5. public class BClass
  6. {
  7.  
  8. public static void Main(string[] args)
  9. {
  10. ManagementObjectSearcher objectSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_TemperatureProbe");
  11.  
  12. foreach (ManagementObject obj in objectSearcher.Get())
  13. Console.WriteLine(obj["Status"]);
  14. }
  15. }

You can use other properties as listed below:
http://msdn2.microsoft.com/en-us/lib...93(VS.85).aspx

but note that, you will need a bit of research because of the manufacturer drivers, on my laptop it doesn't work because I don't have appropriate drivers because I have an apple mac book so it doesn't show anything, but you can read here for more information:
http://groups.google.de/groups?q=cpu+temperature+dotnet

you can browse other WMI Classes to use for other purposes (see the list on the left)
milot is offline   Reply With Quote
Old Jan 6th, 2008, 11:58 AM   #6
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 189
Rep Power: 1 mattireland is on a distinguished road
Send a message via MSN to mattireland Send a message via Skype™ to mattireland
Re: Temperature Controls

Thanks! The C# was helpful!

There are two ways (almost the same) I managed to find (with some help) in VB.NET:

Imports System
Imports System.Management

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Try
        '    Dim searcher As New ManagementObjectSearcher("root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature")

        '    For Each queryObj As ManagementObject In searcher.Get()
        '        Dim temp As Double = CDbl(queryObj("CurrentTemperature"))
        '        temp = (temp - 2732) / 10.0
        '        MessageBox.Show(temp.ToString)
        '    Next

        'Catch ex As ManagementException
        '    MessageBox.Show(ex.Message)
        'End Try

        Dim tempReturn As Management.ManagementObjectCollection

        Dim tempSearch As Management.ManagementObjectSearcher

        Dim temp As Management.ManagementObject

        Dim StrOut As String

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

        tempReturn = tempSearch.Get

        For Each mo In tempReturn

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

        Next

        MsgBox(StrOut)

    End Sub

End Class

Unfortunately, they don't work for me either. Is there any way that you know that I can get the drivers to make them work/include them in the application?

Thanks!

Matt. I
__________________
Matt Ireland
http://www.mattireland.org
matt@mattireland.co.uk
mattireland is offline   Reply With Quote
Old Jan 6th, 2008, 7:54 PM   #7
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovė/Prishtinė
Posts: 45
Rep Power: 0 milot is on a distinguished road
Re: Temperature Controls

Well I did a bit of research on "why-wmi-doesn't-support-Win32_TemperatureProbe" and figured out that WMI doesn't support this feature right now, but it will in the near future, but I saw that this guy -> http://geekswithblogs.net/cicorias/a.../22/97855.aspx wrote a little software for temperature monitor and you can download its source code, but I downloaded the installer and when I open the main assembly it throws an exception see the picture below:



because he used the same techniques that we discussed above this post. So keep googling and if you find something useful, notify us, in meantime I will try finding the solution and will reply for notification.
milot is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Temperature monitoring - Harware Wizard1988 Coder's Corner Lounge 6 Jul 18th, 2007 3:12 PM
How to create office xp like menus and other custom controls some1 C++ 5 Nov 8th, 2005 2:28 PM
Question about loading controls Benoit Visual Basic 2 Sep 20th, 2005 2:01 AM
Determining a client computer's core temperature Kami ASP 2 Jul 17th, 2005 2:44 AM
Temperature Conversion Program - Help! shangnyun Java 32 Jun 12th, 2005 8:31 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC