Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Launch an App and Get the Process ID Handle

Keywords: 	  launch app process ID handle WinItemProcID

Question:

There are ways to get the handle of an app by looking for a window, but is there a way to get the handle while launching the app?

I've looked at RunShell, but I'm still confused as to whether this is able to get the right kind of id/handle?

Basically I'm launching an app that does have a title bar, so I want to be able to send keys to it based on the handle instead. Is this possible?

Answer:

You need both the RunShell with the @GETPROCID parameter and you need the WinItemProcID function to get a useful window handle from the process handle.

RunShell can return a process id. Once you have obtained the process id you can use WinItemProcID (process-id, flags, return-type) to return a list of window ID's for the specified process.

Once you determine the window id you can use that window id in the the SendKeysTo statements....

Start with the example for the WinItemProcID function.


Article ID:   W14616
Filename:   Launch App and Get Process ID Handle.txt