Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with launching external programs
Message
From
21/10/1997 04:24:47
 
 
To
All
General information
Forum:
Visual C++
Category:
Other
Title:
Problems with launching external programs
Miscellaneous
Thread ID:
00055694
Message ID:
00055694
Views:
61
Here's my situation: I'm trying to launch an email program when new mail arrives. The email program supports having multiple windows, but I only want to launch it once and activate the window when new mail arrives. The reason why I need to activate the window is so that I can use the SendKeys function to send keys to the window after I activate it (to download mail, etc...) Here's where the problem begins:

Shell returns a ProcessID that I can use with AppActivate in order to achieve the above. But, if the email program is already running before I shell to it then AppActivate will not activate the window that I shelled to and a new window of the same program is created. Furthermore, when my app launches the email program and the user closes it and runs another program this new program somehow takes the ProcessID of the email program and it gets activated instead of the email program and the keys are sent to it (This only happens sometimes, but it's a very bad bug...)

Now I've been trying to use the CreateProcess API, but the problem with that is that it only returns the process handlers in PROCESS_INFORMATION and the SetFocusAPI function needs a hwnd handle in order to work. The same problem as above applies here as well - if the program is already running before my app launches it, no usable ProcessID is returned. Is this because the other window is the parent window?

Is there any way to get the hwnd handle from the pinfo that CreateProcess returns?

Is there another way of going about this that I haven't thought of?

Thanks in advance for any help...
Wayne
Reply
Map
View

Click here to load this message in the networking platform