0

I want to launch an application as windows shell does when double clicked a file(.doc;.xls) OR a shortcut(.LNK) or and exe. Then i want to get the pid and window handle of launched application.

Currently i am using ShellExecuteEx to launch correspoding app for (File, .lnk or .exe). and getting the pid from handle returned by ShellExecuteEx. Which doesn't work for few applications like(AdobeReader, outlook, etc.) but that i tried to handle by getting "running application list before" and taking difference after calling ShellExecuteEx to get the newly launched app for such cases.

But in case an app was already running( for an opened word doc) OR in case of apps with tabbed interface (which doesn't necessarily spawn a new process) When i execute ShellExecuteEx it just brings that App in top, handle returned is 0, and also i do not get any difference in pids (as no new process is spawned)

So in this case i am not able to get the pid or window handle of the app running.

can someone please suggest any reliable way to solve this problem

Thanks in advance

Rakesh
  • 271
  • 1
  • 2
  • 11

0 Answers0