AutoHotkey Community

It is currently May 25th, 2012, 10:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: July 6th, 2007, 8:11 pm 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Hi!
I need to pause a process that has not been started by my script. I know its PID, process name or exe path to identify it.
Is it a way to pause and resume that process, in a manner similar to changing its priority?

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 8:20 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
I don't think J Random Process can be paused. can you set the priority th the lowest setting?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 8:44 pm 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Well, it's possible, of course, but the goal is to pause it completely, to avoid heavy IO operations.

When two processes are writing large files to disc at the same time, the CPU load of each process is usually not high, and therefore even with both processes running at idle priority, too many disc accesses occur.

I would like to launch several instances of the same program, and pause all of them but one to minimize the IO operations. When the first process has finished its job, the next one should resume automatically. Unfortunately using the idle priority is not sufficient in this case.

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 8:54 pm 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
you could use PsSuspend launched via ahk's run command.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 10:12 pm 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Nice finding!

But, IMO, the existence of this tool proves that there must be some kernel function able to do what I need. I would like to use it instead of an external tool.

Thanks anyway!

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 11:07 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
if you can find a related function in MSDN, post here, and a DllCall wizard may be able to figure out how to call it.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2007, 11:36 pm 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Unfortunately, I have just browsed the MSDN site, and found nothing directly exploitable (except, perhaps, SuspendThread, but I don't know how to retrieve the thread information.)

Also, PsSuspend source code is not available any more. Pity! :(

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 8:33 am 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
This one Looks like it has full source and description, should be able to establish what to do from that.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 10:22 am 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Thanks!

Currently, I have implemented the pause using pssuspend.exe and it works pretty well, although it is better to hide the windows pertaining to the suspended process (as they are not refreshed any more.) Luckily, it's easy to do with AHK, but I have still to improve the method to hide ALL windows sharing the same process.

Also, as you can imagine, pausing a system process can be extremely dangerous. For example, suspend explorer.exe to see what I mean, and prepare to reboot! ;-)

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 11:33 am 
Offline

Joined: November 2nd, 2004, 2:43 pm
Posts: 1019
Location: London, UK
Yeah I know what you mean, I used to use a pssuspend remotly at work combined with a few other apps.

Locking the PC first then pausing winlogon was a good one lol.

Remote task manager has a front end that can perform this task too. And can do it remotely too.

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 11:51 am 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
I have searched the forum, but couldn't find the answer. How can I retrieve the complete list of all windows opened by a specific process? (I am already able to find the parent window of the process, but cannot find the children.)

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 12:24 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
r0lZ wrote:
How can I retrieve the complete list of all windows opened by a specific process?


Code:
DetectHiddenWindows, ON ; You should avoid this for your purpose!!
PID := DllCall("GetCurrentProcessId")

Gui, 1:Show, x0 y0   w200 h100, Test Window1
Gui, 2:Show, x205 y0 w200 h100, Test Window2

WinGet, List, List, ahk_pid %PID%

Loop %List%
 {
   WinGetTitle, Title, % "ahk_id " List%A_Index%
   Wins .= Title "`n"
 }

MsgBox, 0, Windows for PID: %PID%,  %Wins%

ExitApp


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2007, 1:27 pm 
Offline

Joined: April 21st, 2007, 9:16 pm
Posts: 178
Ah, OK! I didn't know the ahk_pid %PID% trick.
Huge thanks!

_________________
r0lZ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], just me, Wicked and 65 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group