 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Should it be added to AHK? |
| Yesh |
|
33% |
[ 2 ] |
| Nesh |
|
66% |
[ 4 ] |
| I can lick my toe |
|
0% |
[ 0 ] |
|
| Total Votes : 6 |
|
| Author |
Message |
Ice_Tea
Joined: 12 Jan 2008 Posts: 114
|
Posted: Sun Jun 29, 2008 1:35 am Post subject: Process, Suspend/Resume, example.exe |
|
|
Hey, there is a command i tend to use to freeze processes, and later resuming them... and to do this with AHK I have to use a another CMDtool to do it, so i were wondering if you could possible add these commands:
| Code: |
; Suspend the process
Process, Suspend, example.exe
; Resume Suspended process
Process, Resume, example.exe
|
This could be useful if you need more CPU cycles, you could temporary freeze the processes thread to temporarily give other stuff more time and then simply resume the frozen process, this way you don't have to close the program.
(I did try doing a search through the forum, but as I've said before, the search function in all forums is useless... tried googling through the forum too...) |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2737 Location: Australia, Qld
|
|
| Back to top |
|
 |
heresy
Joined: 11 Mar 2008 Posts: 291
|
Posted: Wed Jul 02, 2008 10:06 am Post subject: |
|
|
| Code: |
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
} |
_________________ Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com |
|
| Back to top |
|
 |
Ice_Tea
Joined: 12 Jan 2008 Posts: 114
|
Posted: Sat Jul 05, 2008 1:12 am Post subject: |
|
|
| heresy wrote: | | Code: |
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
} |
|
oh snap will you marry me? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|