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
    Code (Text):
    1.  
    2. Imports System
    3. Imports System.Management
    3. Make a button and double click it and add the following.

    Code (Text):
    1.  
    2.  Try
    3.  
    4.             Dim searcher As New ManagementObjectSearcher("root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature")
    5.  
    6.  
    7.  
    8.             For Each queryObj As ManagementObject In searcher.Get()
    9.  
    10.                 Dim temp As Double = CDbl(queryObj("CurrentTemperature"))
    11.  
    12.                 temp = (temp - 2732) / 10.0
    13.  
    14.                 MessageBox.Show(temp.ToString)
    15.  
    16.             Next
    17.  
    18.         Catch err As ManagementException
    19.  
    20.             MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
    21.  
    22.         End Try
    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