Public Class Form1 Dim cpuUsage As New PerformanceCounter("Processor", "% Processor Time", "_Total") Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim timer1 As Timer = New Timer() timer1.Interval = 1000 '1000ms = 1s timer1.Enabled = True 'start timer AddHandler timer1.Tick, AddressOf Timer1_Tick 'add handler End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) ListBox1.Items.Add(cpuUsage.NextValue) End Sub End Class
CPU usage vb2010
Subscrever:
Enviar feedback (Atom)
Sem comentários:
Enviar um comentário