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 commands

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
[deXter]



Joined: 28 Nov 2004
Posts: 35

PostPosted: Tue Dec 05, 2006 6:57 am    Post subject: [Process] Suspend/Resume commands Reply with quote

Suspend is a handy feature I use (using process.exe) when I really need to save up on CPU cycles- instead of closing a whole bunch of apps and reloading them later, I simply suspend the whole lot and resume them. Better than setting the priority to idle, and almost as good as closing the app.

Would be nice if AHK had this feature built-in.
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Dec 05, 2006 10:05 am    Post subject: Reply with quote

Since you can do it with a program, why build it in AutoHotkey, with little change this is used by somebody else than you?
When I type in my text editor, the AutoHotkey Help window is unlikely to eat CPU cycles. Same for Word, beside its automatic save feature which won't kick if document is saved. Perhaps a browser will continue to run a Flash animation, I don't know if it does it when minimized.
So overall the benefit seems small, unless I am missing something. Saving memory by forcing the application to go in the swap file would be more useful.
Just my 2€c.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
[deXter]



Joined: 28 Nov 2004
Posts: 35

PostPosted: Tue Dec 05, 2006 10:31 am    Post subject: Reply with quote

You do have a point there, but personally, I'm using an old P3-450 Mhz comp with around 40-50 processes running at any given time, so I do everything I can to save CPU cycles Smile

Besides that, suspend is also useful if you'd like to actually "pause" a program during execution, for eg, say you'd like to pause a game that doesn't support pausing.

In your point about the flash animation, your browser does continue to run the animation, although it will be saving a few cycles as it doesn't have to draw the frames on the screen, but yeah, it continues to run it when minimized. Now say this flash animation was a game, (and since most flash games don't have a pause option), using the PROCESS_SUSPEND_RESUME (0x0800) call you'd actually be pausing it!

My point is that there is a lot of scope for the suspend feature; introducing it in AutoHotkey will make for a lot of interesting scenarios/solutions. Besides, its just a few more lines of code and pretty easy to implement.
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Tue Dec 05, 2006 12:10 pm    Post subject: Reply with quote

I understand you, I have a P2 300 at home...
Providing more complete use case as you did can help persuading Chris that it is useful...
You seems to know a bit on the subject, perhaps you can research it a little more and provide relevant info to Chris to save him some work.
It can be a useful addition to the Process command.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Dec 05, 2006 12:59 pm    Post subject: Reply with quote

This exact feature has already been requested before. Someone pointed out the following article with some source code (not sure if its method is usable via DllCall, or whether it's the best method compared to whatever process.exe uses): http://www.codeproject.com/threads/pausep.asp
Back to top
View user's profile Send private message Send e-mail
JGR



Joined: 15 Jun 2006
Posts: 52
Location: Unavailable until ~30th August

PostPosted: Sat Dec 09, 2006 4:37 pm    Post subject: Reply with quote

Try:
Code:
DllCall("ntdll\ZwSuspendProcess", "UInt", phndl)
DllCall("ntdll\ZwResumeProcess", "UInt", phndl)


This works on all NT-based machines, it uses the NTAPI.
The quoted method in the previous post is a very long-winded way of doing effectively the same thing.

JGR
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Dec 09, 2006 5:13 pm    Post subject: Reply with quote

Thanks.
Back to top
View user's profile Send private message Send e-mail
[deXter]



Joined: 28 Nov 2004
Posts: 35

PostPosted: Sat Dec 09, 2006 5:14 pm    Post subject: Reply with quote

Thanks a lot JGR Smile
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