LinuZ Posted July 10, 2008 Share Posted July 10, 2008 I would like a program to freeze when I hit a certain hotkey and then listen at another hotkey to "respond" the program/process. I know how to do this and I thought of a while loop when hotkey got hitted, however my main problem is: I don't find a function for it. Could someone help me to find it in MSDN (& optional make it autoit muttley)? THANKS! Link to comment Share on other sites More sharing options...
James Posted July 10, 2008 Share Posted July 10, 2008 Search "pause". Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
LinuZ Posted July 10, 2008 Author Share Posted July 10, 2008 Search "pause".Thank you, I did this but the only things I found was functions for pausing the own application and some topics on timers. Did you understand what I ment, should I clarify; I want to be able to for example freeze notepad.exe so it is not usable until a hotkey it hit. Thanks in advance! Link to comment Share on other sites More sharing options...
James Posted July 10, 2008 Share Posted July 10, 2008 Thank you, I did this but the only things I found was functions for pausing the own application and some topics on timers. Did you understand what I ment, should I clarify; I want to be able to for example freeze notepad.exe so it is not usable until a hotkey it hit. Thanks in advance!WinSetState()? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
JamesDover Posted July 10, 2008 Share Posted July 10, 2008 (edited) Maybe this might help you. Dim $Pause = 0 HotKeySet("{F2}", "Paus") Func Paus() ToolTip('Paused', 470, 200) Sleep(500) $Pause = $Pause + 1 PauseCheck() EndFunc ;==>Paus Func PauseCheck() If $Pause = 1 Then Sleep(1980 + Random(20, 60, 1)) PauseCheck() Elseif ToolTip('', 470, 200);kills paused tooltip EndIf Edited July 10, 2008 by JamesDover Link to comment Share on other sites More sharing options...
LinuZ Posted July 10, 2008 Author Share Posted July 10, 2008 (edited) Maybe this might help you. Dim $Pause = 0 HotKeySet("{F2}", "Paus") Func Paus() ToolTip('Paused', 470, 200) Sleep(500) $Pause = $Pause + 1 PauseCheck() EndFunc;==>Paus Func PauseCheck() If $Pause = 1 Then Sleep(1980 + Random(20, 60, 1)) PauseCheck() Elseif ToolTip('', 470, 200);kills paused tooltip EndIfThanks, but this just pauses the program itself, I want the program able to pause another program. Rendering the program unable to do anything... WinSetState()?Ye that fixes so the user isn't able to use the window, but what if the process will keep on for example downloading something? Edited July 10, 2008 by LinuZ Link to comment Share on other sites More sharing options...
LinuZ Posted July 11, 2008 Author Share Posted July 11, 2008 (edited) Hiho, I searched for the problem and I found a source code in autohotkey any guru knows how to make it work?Run, Notepad.exe WinWait, ahk_class Notepad Process_Suspend("Notepad.exe") MsgBox, Notepad.exe suspended Sleep, 5000 Process_Resume("Notepad.exe") MsgBox, Notepad.exe resumed Exitapp ;============================== Working on WinXP+ Process_Suspend(PID_or_Name){ PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid) If !h Return -1 DllCall("ntdll.dll\NtSuspendProcess", "Int", h) DllCall("CloseHandle", "Int", h) } Process_Resume(PID_or_Name){ PID := (InStr(PID_or_Name,".")) ? ProcExist(PID_or_Name) : PID_or_Name h:=DllCall("OpenProcess", "uInt", 0x1F0FFF, "Int", 0, "Int", pid) If !h Return -1 DllCall("ntdll.dll\NtResumeProcess", "Int", h) DllCall("CloseHandle", "Int", h) } ProcExist(PID_or_Name=""){ Process, Exist, % (PID_or_Name="") ? DllCall("GetCurrentProcessID") : PID_or_Name Return Errorlevel }^the autohotkey code^My try, correct me please muttley#Include <WinAPI.au3>$process = _WinAPI_OpenProcess("PROCESS_SUSPEND_RESUME", 1, "process.exe")DllCall("ntdll.dll", "Int", "NtSuspendProcess", "Int", $process)DllCall("Kernel32.dll", "Int", "CloseHandle", "Int", $process)EDIT: Ahh, never mind... I found CoProc! Thanks for those you helped Edited July 11, 2008 by LinuZ Link to comment Share on other sites More sharing options...
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