AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Process, Suspend/Resume, example.exe

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  

Should it be added to AHK?
Yesh
33%
 33%  [ 2 ]
Nesh
66%
 66%  [ 4 ]
I can lick my toe
0%
 0%  [ 0 ]
Total Votes : 6

Author Message
Ice_Tea



Joined: 12 Jan 2008
Posts: 114

PostPosted: Sun Jun 29, 2008 1:35 am    Post subject: Process, Suspend/Resume, example.exe Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2737
Location: Australia, Qld

PostPosted: Sun Jun 29, 2008 6:22 am    Post subject: Re: Process, Suspend/Resume, example.exe Reply with quote

300W wrote:
tried googling through the forum too...
I used site:autohotkey.com suspend process and got Suspend Process as the first result.
Just for kicks, I also tried the site's own search function and again got Suspend Process as the first result.
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Wed Jul 02, 2008 10:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Ice_Tea



Joined: 12 Jan 2008
Posts: 114

PostPosted: Sat Jul 05, 2008 1:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group