本帖最后由 pcl_test 于 2015-7-6 14:58 编辑
or可以的- Set objWMIService = GetObject("winmgmts:")
- Set ProcessList = objWMIService.ExecQuery("select * from win32_process where name='calc.exe' or name='notepad.exe'")
- If ProcessList.Count = 0 Then
- MsgBox "指定进程未运行或用户权限不足以获得其信息。"
- Else
- For Each objProcess In ProcessList
- rtn = MsgBox("进程 " & objProcess.name & " 的 PID 是 " & objProcess.ProcessId&vbCrLf&"您确定要终止该进程吗?", vbYesNo, "关闭进程")
- If rtn = 6 Then objProcess.Terminate
- Next
- End If
复制代码
|