#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
Global $list
GUICreate("Завершитель процессов",500,500)
Local $idListview = GUICtrlCreateListView("Имена процессов", 0, 10, 500, 250)
Local $idButton = GUICtrlCreateButton("Завершить процесс", 0, 350, 150, 50)
Set_process()
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
$proccessname = StringMid(GUICtrlRead(GUICtrlRead($idListview)),1,StringLen(GUICtrlRead(GUICtrlRead($idListview)))-1)
While ProcessExists($proccessname)
ProcessClose($proccessname)
If @error = 2 then
msgbox(0,"сообщение","не могу завершить системный процесс")
ExitLoop
endif
If @error = 3 then
msgbox(0,"сообщение","процесс завершен")
ExitLoop
endif
WEnd
Set_process()
EndSwitch
WEnd
func Set_process()
_GUICtrlListView_SetColumnWidth( $idListview , 0,500)
_GUICtrlListView_DeleteAllItems($idListview)
$list = ProcessList()
for $i = 3 to $list[0][0]
Local $idItem = GUICtrlCreateListViewItem("", $idListview)
GUICtrlSetData($idItem, $list[$i][0])
next
EndFunc
|