#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#RequireAdmin
Func _PROCESSSUSPEND($PROCESS)
$PROCESSID = ProcessExists($PROCESS)
If $PROCESSID Then
$AI_HANDLE = DllCall("kernel32.dll", "int", "OpenProcess", "int", 2035711, "int", False, "int", $PROCESSID)
$I_SUCESS = DllCall("ntdll.dll", "int", "NtSuspendProcess", "int", $AI_HANDLE[0])
DllCall("kernel32.dll", "ptr", "CloseHandle", "ptr", $AI_HANDLE)
If IsArray($I_SUCESS) Then
Return 1
Else
SetError(1)
Return 0
EndIf
Else
SetError(2)
Return 0
EndIf
EndFunc
Func _PROCESSRESUME($PROCESS)
$PROCESSID = ProcessExists($PROCESS)
If $PROCESSID Then
$AI_HANDLE = DllCall("kernel32.dll", "int", "OpenProcess", "int", 2035711, "int", False, "int", $PROCESSID)
$I_SUCESS = DllCall("ntdll.dll", "int", "NtResumeProcess", "int", $AI_HANDLE[0])
DllCall("kernel32.dll", "ptr", "CloseHandle", "ptr", $AI_HANDLE)
If IsArray($I_SUCESS) Then
Return 1
Else
SetError(1)
Return 0
EndIf
Else
SetError(2)
Return 0
EndIf
EndFunc
$List = ProcessList()
$Data = ''
For $i = 1 To $List[0][0]
$Data &= '|' & $List[$i][0]
Next
$Form1 = GUICreate("Process Watcher", 300, 200, 192, 124)
$Combo = GUICtrlCreateCombo('', 20, 20, 260, 160, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, StringTrimLeft($Data, 1), $List[1][0])
GUICtrlCreateLabel('Идентификатор процесса:', 30, 60, 80, 70)
$Label = GUICtrlCreateLabel($List[1][1], 43, 50, 40, 14)
$Button1 = GUICtrlCreateButton("Завершить", 20, 100, 75, 25)
$Button2 = GUICtrlCreateButton("Заморозить", 100, 100, 75, 25)
$Button3 = GUICtrlCreateButton("Продолжить", 180, 100, 75, 25)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Combo
GUICtrlSetData($Label, ProcessExists(GUiCtrlRead($Combo)))
Case $Button1
ProcessClose(ProcessExists(GUiCtrlRead($Combo))) ; или ProcessClose(GUiCtrlRead($Combo))
Case $Button2
_PROCESSSUSPEND((ProcessExists(GUiCtrlRead($Combo))))
Case $Button3
_PROCESSRESUME ((ProcessExists(GUiCtrlRead($Combo))))
EndSwitch
WEnd