프로그래밍언어/VB.NET

CPU온도 가져오기

부산딸랑이 2016. 10. 9. 04:41

http://stackoverflow.com/questions/31774626/how-can-i-see-temperature-of-cpu-using-vb-net-with-open-hardware-monitor-dll


http://openhardwaremonitor.org/



Imports System.Management
Imports System
Imports OpenHardwareMonitor
Imports OpenHardwareMonitor.Hardware

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Timer1.Enabled = True Then
            Timer1.Enabled = 0
        Else
            Timer1.Enabled = 1

        End If

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim cp As New Computer()
        cp.Open()
    
        cp.CPUEnabled = True

        Dim Info As String = ""
        For i As Integer = 0 To cp.Hardware.Count() - 1

            If cp.Hardware(i).HardwareType = HardwareType.CPU Then
                Info += " Processor: " & Trim(cp.Hardware(i).Sensors(5).Value) & vbCrLf
            End If
        Next


        Label1.Text = Info


    End Sub
End Class