| View previous topic :: View next topic |
| Author |
Message |
[deXter]
Joined: 28 Nov 2004 Posts: 35
|
Posted: Tue Dec 05, 2006 6:57 am Post subject: [Process] Suspend/Resume commands |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Dec 05, 2006 10:05 am Post subject: |
|
|
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 |
|
 |
[deXter]
Joined: 28 Nov 2004 Posts: 35
|
Posted: Tue Dec 05, 2006 10:31 am Post subject: |
|
|
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
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Dec 05, 2006 12:10 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Dec 05, 2006 12:59 pm Post subject: |
|
|
| 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 |
|
 |
JGR
Joined: 15 Jun 2006 Posts: 52 Location: Unavailable until ~30th August
|
Posted: Sat Dec 09, 2006 4:37 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sat Dec 09, 2006 5:13 pm Post subject: |
|
|
| Thanks. |
|
| Back to top |
|
 |
[deXter]
Joined: 28 Nov 2004 Posts: 35
|
Posted: Sat Dec 09, 2006 5:14 pm Post subject: |
|
|
Thanks a lot JGR  |
|
| Back to top |
|
 |
|