Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to wait for completion of shellexec ?
Message
From
09/01/2003 12:43:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/01/2003 11:44:04
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00739175
Message ID:
00739878
Views:
21
>Yes, I read the thread already. But after I read all, I can't really follow what you are after. I just took the whole point of your thread that you are trying to make a tracker (like Spy). Eventhough maybe I had some idea but I'm not sure whether it will help or not. So I don't want to jump into the thread.
>
>The reason I replied into this thread is because of the title. If you only want to use ShellExecute and wait for it to finish, I have a solution for this. But as I mentioned it's *dirty*. And it won't work if the created window is hidden (need another solution)
>
>Yes, CreateProcess use WaitForSingleObject (WFSO) to wait and that's what I meant on the first line. What I mean is you can also use the WFSO for ShellExecute.
>I prefer CreateProcess is because it's already provided the process handle (not provided with ShellExecute) to use in the WFSO so I consider it as *clean* method.
>And WScript is Windows Script Host. I am sorry for my language. My english is not good :)
>
>Anyway, here is the detail:
>**** dirty part
>- Setforegroundwindow into VFP main window.
>- ShellExecute
>- Make a tight loop on Getforegroundwindow as long as the return handle is same with VFP main window.
>*****
>- Get process ID from the return window handle
>- Open the process (synchronize) from the process ID
>- WFSO
>
>HTH

Herman,
What if I have 2 instances of my vfp exe shellexecuting the same exe ? Some apps like word has only one PID. Syncing on it all VFP instances wait for all word sessions to be done, no ?
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