Jussip Posted September 20, 2008 Posted September 20, 2008 (edited) Ahoy there, Is there a way to freeze a process with autoit? Not killing it, freezing. If you try open window of the frozen process it wont open? And a way to unfreeze it? If there is a way, could you add it to my GUI what i made.. #include <GUIConstants.au3> $Gui1 = GUICreate("Process Freezer", 397, 133, 211, 154, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_APPWINDOW,$WS_EX_CONTEXTHELP,$WS_EX_LEFTSCROLLBAR,$WS_EX_RIGHT,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)) $Freeze = GUICtrlCreateButton("Freeze", 16, 64, 161, 49, 0, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) $DeFreeze = GUICtrlCreateButton("DeFreeze", 216, 64, 161, 49, 0, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) $Input1 = GUICtrlCreateInput("Process to freeze", 56, 16, 297, 28) GUICtrlSetFont(-1, 12, 400, 2, "Arial Narrow") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Freeze Case $DeFreeze EndSwitch WEnd Edited September 20, 2008 by jiibah
Andreik Posted September 20, 2008 Posted September 20, 2008 This should help you:http://www.autoitscript.com/forum/index.ph...st&p=238180
Jussip Posted September 20, 2008 Author Posted September 20, 2008 (edited) This should help you:http://www.autoitscript.com/forum/index.ph...st&p=238180Wow! Looks great..Way to add it on my script?Mean, im not that good with inputs =) Edited September 20, 2008 by jiibah
Andreik Posted September 20, 2008 Posted September 20, 2008 expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> $Gui1 = GUICreate("Process Freezer", 397, 133, 211, 154, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_APPWINDOW,$WS_EX_CONTEXTHELP,$WS_EX_LEFTSCROLLBAR,$WS_EX_RIGHT,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)) $Freeze = GUICtrlCreateButton("Freeze", 16, 64, 161, 49, 0, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) $DeFreeze = GUICtrlCreateButton("DeFreeze", 216, 64, 161, 49, 0, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) $Input1 = GUICtrlCreateInput("Process to freeze", 56, 16, 297, 28) GUICtrlSetFont(-1, 12, 400, 2, "Arial Narrow") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Freeze _ProcessSuspend(GUICtrlRead($Input1)) Case $DeFreeze _ProcessResume(GUICtrlRead($Input1)) EndSwitch WEnd Func _ProcessSuspend($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, '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', 0x1f0fff, '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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now