[vb]代码库
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'功能:结束指定名称的所有进程
'函数名:terminateProcessB
'入口参数:proName,要结束的进程名
'备注:sysdzw 于 10:33 2007-08-19 提供
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub terminateProcessB(ByVal proName As String)
Dim objWMIService As Object
Dim colProcessList As Object
Dim objProcess As Object
Set objWMIService = GetObject("winmgmts:" & "{impersonationlevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name='" & proName & "'")
If colProcessList.Count <> 0 Then
For Each objProcess In colProcessList
objProcess.Terminate
Next
End If
End Sub