1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Visual Basic 2008 CPU Temp

Discussion in 'Programming' started by poblo10, Mar 1, 2010.

  1. #1
    CPU TEMP
    NOTE: If your using Vista/7 when you try to debug it, it will get an error because u need to run as admin


    1. Start a new project.

    2. Above Public Class section add
    
    Imports System
    Imports System.Management
    Code (markup):
    3. Make a button and double click it and add the following.

    
     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 err As ManagementException
    
                MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
    
            End Try
    Code (markup):
    I'll put a tut for viewing CPU usage soon.
    And once i post all my tuts you will be able to make your own simple task manager. Even though windows task manage is already good enough being able to make your own is just fun because you can add just about anything you want.

    Well just say thanks if you like
    -------------------------------------------------------
    Originally posted at
    http://www.f47al3rr0r.net/forum/
    &
    http://www.techforumz.net/forum/
     
    poblo10, Mar 1, 2010 IP