Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to get HWND of ShellExecute launched app
Message
From
07/01/2003 11:00:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00738764
Message ID:
00738804
Views:
22
>>>>>>or a way to get it from CreateProcess launched one ? TIA
>>>>>
>>>>>Cetin,
>>>>>
>>>>>Outside of FindWindow() or iterating through the active windows, there's no direct translation function, AFAIK.
>>>>
>>>>Yes I think you're right. Desperately trying codes no good solution. I created a FLL to enumwindows but it goes like this :
>>>>
>>>>*Main.App
>>>>Get a launch request - ShellExecute another one as watcher (with some more params)
>>>>Get a launch request - ShellExecute another one as watcher
>>>>Get a launch request - ShellExecute another one as watcher
>>>>
>>>>Now watcher(s) has a problem. If requests are made with some split times they find the window right. If all request were done say from same routine, 3rd one might put up its window before 1st, leaving me no way to distinguish :(
>>>
>>>Cetin,
>>>
>>>This is just a guess, and I really don't know off-hand all the various parts of the solution.
>>>
>>>How about creating a unique mutex which each one, then when you get the hWnd, checking to see if it owns it?
>>
>>Good point George :) Unfortunately I couldn't yet understand 'mutex' and how to create check it :)
>
>Cetin,
>
>Best place to start is in the MSDN library. Look at the CreateMutex() function. The see also for the function points to two articles that may be of help "Synchronization Overview" and Synchronization Functions".
>
>It would seem to me to be worth at least a glance, since it appears from your description that's the heart of the problem.

Honestly I've been browsing and testing them since monday :) Mutex functions was one them I searched (and rereading). They're using WaitForSingleObject which doesn't wait and immediately return on applications like word (multiple instance). Wish hInstance ShellExecute returns was something usefull (or pid,tid from CreateProcess or ShellExecuteEx).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform