>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
ENDIF
--sb--