View Single Post
Old Jan 6th, 2008, 11:58 AM   #6
mattireland
Hobbyist Programmer
 
mattireland's Avatar
 
Join Date: Jul 2007
Location: Wales, United Kingdom
Posts: 203
Rep Power: 2 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