Anda di halaman 1dari 3

Membuat Program Proses Hunter di VB.

Net

1. Buat Prject Baru dengan Nama ProjLatihan1


2. Buat satu buah form, simpan dengan nama Frm_Latihan1
3. Buat desainnya seperti di bawah ini :

LISTBOX1

2 Buah
Command
Button

Komponen yang terdapat di dalam desain form diantaranya :


a. 1 Buah LISTBOX1
b. 2 buah Command Button
4. Ketikkan kode Programnya seperti gambar di bawah ini

5. Atau di bawah ini


Imports System.Diagnostics.Process
Public Class Form1
Inherits System.Windows.Forms.Form
Dim proces As Process
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'On Error Goto Fix
'dim Str As String=InputBox("Enter process to kill",""Process
Killer","Killer")
For Each proces In GetProcesses()
'If proces.ProcessName = Str.ErrorToString Or
Process.ProcessName="smss" Then
' proces.Kill()
'End If
Me.ListBox1.Items.Add(proces.ProcessName)
Next
'Fix
'End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'MsgBox(Me.ListBox1.SelectedItem)
For Each proces In GetProcesses()
If proces.ProcessName = Me.ListBox1.SelectedItem Then
proces.Kill()
End If
Next

Me.ListBox1.Items.RemoveAt(Me.ListBox1.SelectedIndex)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
End Class

Anda mungkin juga menyukai