Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ShellExecute WaitForSingleObject IsRunning(GeorgeTasker)
Message
From
20/03/2004 09:15:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/03/2004 12:00:48
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00887963
Message ID:
00888200
Views:
35
This message has been marked as a message which has helped to the initial question of the thread.
< snip >
...
However, I need to stop processing in my app until Adobe Acrobat Reader is closed so I can then delete the .pdf and .xfdf files. I cannot use createprocess because createprocess only works with executables. The handle returned by isrunning is never found using waitforsingleobject. Any idea how can I convert the value returned by isrunning() to a value required by waitforsingleobject?
...
< snip >

PMFJI Tracy,
I also had a need to waitfor completion of shellexecuted files. It was not as easy as using WaitForSongleObject. It simply didn't work for my case, I could easily defeat it not waiting anymore though it should. The result I sorted was more a cheat checking windows existing before and after the call to shellexecute was made (and honestly even it was not an easy one as some applications first spawn a window and that window spawns another passing the control and kills first window). Then I simply checked 'captured' window's being a valid window or not (IsWindow). It worked, but rather complex as I needed to create an FLL for it (VFP didn't support callback functions I used).
Now back to your problem :) I don't think you ever need complex API to wait app to finish. Since all you want to be able to delete it you might instead check if you can.

Spawn a timer
Timer checks if it could open the files ReadWrite
If it can, closes the file and deletes, disables itself

With timer approach you don't even need to wait for it, continue your work on something else. Or if you absolutely want to wait you might create a do while loop with Sleep() in it.

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
Reply
Map
View

Click here to load this message in the networking platform