mhben
Try substituting the following WinAPI call for your RUN command.
The called Windows application retains control until you close it.
It works under VFP6 but I can't vouch for VFP5.
* You will need to redefine lcProgram
lcProgram = ALLT(USER.editor);
[tab]+[ "];
[tab]+ALLT(SHEETS.filename);
[tab]+["] && Define lcProgram
#DEFINE NORMAL_PRIORITY_CLASS 32
#DEFINE IDLE_PRIORITY_CLASS 64
#DEFINE HIGH_PRIORITY_CLASS 128
#DEFINE REALTIME_PRIORITY_CLASS 1600
#DEFINE WAIT_TIMEOUT 0x00000102
#DEFINE WAIT_INTERVAL 200
DECLARE INTEGER CreateProcess IN kernel32.DLL ;
[tab]INTEGER lpApplicationName, ;
[tab]STRING lpCommandLine, ;
[tab]INTEGER lpProcessAttributes, ;
[tab]INTEGER lpThreadAttributes, ;
[tab]INTEGER bInheritHandles, ;
[tab]INTEGER dwCreationFlags, ;
[tab]INTEGER lpEnvironment, ;
[tab]INTEGER lpCurrentDirectory, ;
[tab]STRING @lpStartupInfo, ;
[tab]STRING @lpProcessInformation
DECLARE INTEGER WaitForSingleObject IN kernel32.DLL ;
[tab]INTEGER hHandle, ;
[tab]INTEGER dwMilliseconds
DECLARE INTEGER CloseHandle IN kernel32.DLL ;
[tab]INTEGER hObject
DECLARE INTEGER GetLastError IN kernel32.DLL
start = long2str(68) + REPLICATE(CHR(0), 64)
process_info = REPLICATE(CHR(0), 16)
File2Run = (lcProgram) + CHR(0)
RetCode = CreateProcess(0, File2Run, 0, 0, 1, ;
[tab]NORMAL_PRIORITY_CLASS, 0, 0, @start, @process_info)
IF RetCode = 0
[tab]=MESSAGEBOX("Error occurred. Error code: ", GetLastError())
[tab]RETURN
ENDIF
hProcess = str2long(SUBSTR(process_info, 1, 4))
DO WHILE .T.
[tab]IF WaitForSingleObject(hProcess, WAIT_INTERVAL) != WAIT_TIMEOUT
[tab][tab]EXIT
[tab]ELSE
[tab][tab]DOEVENTS
[tab]ENDIF
ENDDO
RetCode = CloseHandle(hProcess)
* Return to FoxPRO
ON ERROR DO ...
Hope does the trick
Chris [sig][/sig]