要杀某个指定名称的进程,用到GetProcesses方法以及kill方法,这点用在杀掉比如VBA编程中的象WORD,EXCEL等进程里是很有效果的
Sub ProcessKill(ByVal ProcessName As String)
Dim pProcess() As Process
pProcess = Process.GetProcesses()
Dim i As Integer
For i = 0 To pProcess.Length() - 1
If (pProcess(i).ProcessName = ProcessName) Then
pProcess(i).Kill()
End If
Next
End Sub
Sub ProcessKill(ByVal ProcessName As String)
Dim pProcess() As Process
pProcess = Process.GetProcesses()
Dim i As Integer
For i = 0 To pProcess.Length() - 1
If (pProcess(i).ProcessName = ProcessName) Then
pProcess(i).Kill()
End If
Next
End Sub