Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting external applications
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00647067
Message ID:
00647220
Views:
17
>I need to be able to determine if a certain external application is done.
>I have a FoxPro 2.6 program which calls an external (VFP) executable. But when it does this the program continues on to the next line of FoxPro 2.6 code. I really need to know when the VFP program has finished.
>
>I suppose the VFP program could create a file on the users SYS(2023) as the VFP program is closing, but I'd like a way to detect the running of the process.
>
>Is there any way I can do this?

You didn't say if you are running DOS or Windows version of FoxPro 2.6. Either of them should wait for external program to finish if RUN command was used w/o /N switch (FPW). If it still doesn't wait even w/o /N switch or you don't want to use that switch, than you can try following:

1. FPD 2.6 or FPW 2.6: Create a flag file at the start of VFP application and close at the end. In FP 2.6 check if you can open it. As long as it exists and you cannot open it, VFP app is still running.

2. In FPW 2.6 you can call Win Api Findwindow function to check if VFP app is still running.
SET LIBRARY TO home()+"FOXTOOLS" ADDITIVE
lnCall16 = RegFN("FindWindow", "L@C", "L")
lcAppTitle = "My VFP Application"
lnHWnd =  CallFN( lnCall16, 0, @lcAppTitle )
IF lnHWnd > 0
	* VFP application still running
ENDIF
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform