2014年4月1日 星期二

Kill Process

'Kill process
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Interval = 5000
        Timer1.Enabled = True
    End Sub

    Sub killProcess(processName)
        Dim process1 As Process()
        process1 = Process.GetProcessesByName(processName)
        For Each proces As Process In process1
            proces.Kill()
        Next
    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
        System.Diagnostics.Process.Start("iexplore")
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Call killProcess("iexplore")
        Call killProcess("mspaint")
    End Sub
End Class

沒有留言: