WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Launching WinBatch and Other Apps
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2000:10:18:09:54:10
Last Updated: 2000:10:18:09:54:10