Author |
Topic |
|
poweruser84
Russia
24 Posts |
Posted - 04/14/2014 : 04:16:27
|
Hi all
Please give me suggestion. I have mouse gesture that suspends current process (which owns window under gesture). I found the way to get EXE's name of process:
acActivateWindow(acGetOwnerWindowByPoint(acGetMouseLocationX(), acGetMouseLocationY()),0,0) exename = acGetExecutableName(acGetForegroundWindow(), 0, 0) acRunProgram("C:\\Windows\\nircmd.exe","win flash foreground 1 1000",0,1) acDelay(2000) acMinimizeWindow(nil, acGetMouseLocationX(), acGetMouseLocationY()) acRunProgram("c:\\Windows\\SysWOW64\\pssuspend.exe",exename,0,0)
But i can't extract PID instead of exe name. I need that to get targeted process suspending not by EXE's name(which can be NOT UNIQUE), but by unique PID (Process ID). |
Edited by - poweruser84 on 04/14/2014 04:18:00 |
|
Rob
USA
2615 Posts |
Posted - 04/14/2014 : 14:24:03
|
I've tried binding to the WinAPI call GetProcessIdOfThread, which gets the threadID fine in the return, but not the process ID in the out parameter; S+ (really Lua) crashes when making the API call, but only when using an alien.core.buffer to store the process ID, I'm not sure what exactly is the point of failure.
However, you could use S+ to suspend:
http://www.strokesplus.com/help/#acPauseResumeThreadList
It will suspend/resume all threads belonging to the process which owns the specified window handle. The only tricky part is storing that window handle for later; well, it's only tricky because if you reload the Lua engine, that variable would be lost and you couldn't resume the process.
Alternatively, you could use the acRegistry* S+ actions to store the PID(s) there, maybe based on something with the EXE name..not sure, but the point is that S+ can suspend/resume a process, you just have to make sure to store the PIDs for later resuming of a process, in the event that S+ reloads the Lua engine, which happens when you click OK on the S+ settings window, for example.
|
|
|
poweruser84
Russia
24 Posts |
Posted - 04/14/2014 : 17:01:38
|
Thank you, Rob
quote: However, you could use S+ to suspend: http://www.strokesplus.com/help/#acPauseResumeThreadList
This method works too much excessively. It suspends explorer.exe(Windows's GUI shell), when the process (targeted for Pause) was initially started from Explorer. Unlike acPauseResumeThreadList, PSSUSPEND.exe utility suspends only selected process and it's derivatives (what i want to do).
So i still need the way to get PID from Window's handle. Pssuspend supports PID as an command line argument.
quote: you just have to make sure to store the PIDs for later resuming of a process, in the event that S+ reloads the Lua engine, which happens when you click OK on the S+ settings window, for example.
Yes, i know. But this factor is not critical for me. |
|
|
|
Topic |
|
|
|