'task_manager in vb.net
' Autore: Dark_Limit
' Data: 15/01/2008
' Ora: 21.24
'
'importo la classe :
Imports System .Diagnostics .Process
Public Partial Class MainForm
Public Sub New()
'inizializzazione dei componenti
Me.InitializeComponent()
Me.button2 . Enabled = False
Me.button4 . Enabled = False
End Sub
Sub Button1Click(ByVal sender As Object, ByVal e As EventArgs)
'utilizzo la classe precedentemente importata
' e visualizzo i processi
Dim prc As Process ()
Dim prop As Integer
Dim priority As Integer
prc = Process . GetProcesses ()
Me . listBox1 . Sorted = False
Dim tgr As Integer
For tgr = 0 To prc.Length - 1 'finchè il processo esiste lo carico nella lista
'proprietà del processo
prop=prc(tgr).Id
priority=prc(tgr).BasePriority
Me . listBox1 . Items . Add ("Nome : " + prc(tgr).ProcessName + ".exe"+" "+" "+"--->"+"PID : " + prop.ToString +" "+" "+"--->"+"Priorità : " + priority.ToString )
Next
' disabilito gli oggetti
Me. button1 . Enabled = False
Me. button2 . Enabled = True
Me. button4 . Enabled = True
End Sub
Sub Button2Click(ByVal sender As Object, ByVal e As EventArgs)
' Pulitura Lista elementi
Me . button1 . Enabled = True
Me . listBox1 . Items . Clear ()
Me . button2 . Enabled = False
Me . button4 . Enabled = False
End Sub
Sub Button3Click(ByVal sender As Object, ByVal e As EventArgs)
' Ordinazione lista elementi
If Me . listBox1 . sorted = False Then
Me . listBox1 .sorted = True
Me . label2 . Text = "Lsta elementi Ordinata!"
End If
End Sub
Sub Button4Click(ByVal sender As Object, ByVal e As EventArgs)
' Refresh della lista
Me.listBox1.Items.Clear()
Dim prc As Process ()
Dim prop As Integer
Dim priority As Integer
prc = Process . GetProcesses ()
Me . listBox1 . Sorted = False
Dim tgr As Integer
For tgr = 0 To prc.Length - 1 ' finchè il processo esiste lo carico nella lista
' Proprietà processi
prop=prc(tgr).Id
priority=prc(tgr).BasePriority
Me . listBox1 . Items . Add ("Nome : " + prc(tgr).ProcessName + ".exe"+" "+" "+"--->"+"PID : " + prop.ToString +" "+" "+"--->"+"Priorità : "+priority.ToString )
Next
' disabilito gli oggetti
Me. button1 . Enabled = False
End Sub
End Class