|
  
|
1#
发表于 2007-4-22 05:56 PM
| 只看该作者
- #include <GUIConstants.au3>
- #notrayicon
- dim $ListView1
- GUICreate("简单的进程管理器", 257, 364)
- $Button1 = GUICtrlCreateButton("结束进程", 8, 328, 105, 25)
- $Button2 = GUICtrlCreateButton("刷新列表", 144, 328, 105, 25)
- $ListView1 = list()
- GUISetState(@SW_SHOW)
- While 1
- $msg = GuiGetMsg()
- Select
- Case $msg = $GUI_EVENT_CLOSE
- ExitLoop
- Case $msg = $Button1
- proclose()
- Case $msg = $Button2
- $ListView1 = list()
- EndSelect
- WEnd
- Exit
- func list()
- if $ListView1 then GUICtrlDelete($ListView1)
- $list = ProcessList()
- $ListView1 = GUICtrlCreateListView("进程名 |PID ", 8, 8, 241, 305)
- for $i = 1 to $list[0][0]
- GUICtrlCreateListViewItem($list[$i][0]&"|"&$list[$i][1],$listview1)
- next
- return $ListView1
- endfunc
- func proclose()
- $pro = stringsplit(GUICtrlRead(GUICtrlRead($listview1)),"|")
- if $pro[0] = 2 then
- if ProcessExists($pro[2]) then ProcessClose($pro[2]) ;;runwait(@ComSpec & " /c taskkill /f /t /pid " & $pro[2],"",@sw_hide)
- else
- msgbox(4096,"错误","无法终止进程!")
- EndIf
- sleep(1000)
- if $pro[0] = 2 then
- if ProcessExists($pro[2]) then
- msgbox(4096,"错误","无法终止进程!")
- return
- endif
- endif
- $ListView1 = list()
- endfunc
复制代码 |
感谢Baidu,Google,Dreams8给我这次机会!
还要感谢我的爸爸妈妈!
HOHO |
|