Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to get HWND of ShellExecute launched app
Message
 
To
07/01/2003 11:34:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00738764
Message ID:
00738847
Views:
24
>>>>>or a way to get it from CreateProcess launched one ? TIA
>>>>>Cetin
>>>>
>>>>Hi Cetin,
>>>>
>>>>Isn't there a way to test whether an HWND is associated with a given process id?
>>>>
>>>>Mike
>>>
>>>Yes there is. But unfortunately some apps (DDE broadcasting) like Word has the same pid for all calls to winword. ie:
>>>
>>>ShellExecute(0,'open','windword.exe',0,0,1)
>>>ShellExecute(0,'open','windword.exe',0,0,1)
>>>ShellExecute(0,'open','windword.exe',0,0,1)
>>>
>>>All 3 have same pid and tid :(
>>>
>>>Cetin
>>
>>Cetin,
>>
>>With Word, you also have the option of using CreateObject/GetObject. Does that help?
>>
>>In Word 97, as I recall, all new instances share a common physical parent window, i.e. like an MDI application. Which HWND would you want to get in that case?
>>
>>In Word XP, each opening has its own top-level window, so this might be handled by a generic launch strategy. I'm not clear on what you're trying to do and what the constraints are. Do you have control of the launching of these arbitrary apps? If so, I could elaborate on a somewhat heuristic general approach, which should work with most apps, including Word XP.
>>
>>Mike
>
>Mike,
>In word97 or XP I can get separate instances (window with title like "document1","document2"). IOW I have no problem getting all applications that task manager lists. See my last reply to George for what I'm trying to accomplish. Called thing might be winword.exe, mydos.com or somebat.bat :(
>Cetin

Yes, I just saw your reply to George. Maybe you would need to use a hybrid approach to cover all of the possible cases, based on certain known characteristics of the application to be launched. If you can modify your asynchronous launching strategy, this might allow you to obtain an HWND after launching an application via ShellExecute by not returning until you've got the HWND. This still would allow the launched job to run concurrently.

I don't know if that was clear, or if I understand your problem quite correctly. When you say "I have no problem getting all applications that task manager lists", I think I must be missing something.

Mike
Montage

"Free at last..."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform