본문 바로가기

자료

[C#,VB,net] CPU온도 가져오기 (temperature of CPU)

728x90

C#,VB.net] CPU온도 가져오기 (temperature of CPU)

 

 


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
728x90