Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Close VFP9 File Lock to Exe

Status
Not open for further replies.

USMA99

Programmer
Oct 12, 2000
82
0
0
US
We're experiencing a problem where we use VFP9 to call an exe (also compiled VFP 9) on a network location and it holds onto that exe file until FoxPro itself is closed. Until the person who called it closes FoxPro, you can't rename, delete, or overwrite, the exe. We've tried the usual close all, clear all, etc.

Is there something that can be done to close the file lock?

Ideally, we'd like to be able to run this exe on multiple computers simultaneously. We do this routinely with compiled fox code (FXPs) all the time without incident. Is there something else going on here I need to look into?

thanks in advance for any help
 
How are you calling the EXE?
Are you using shellexecute?



Ali Koumaiha
Wireless Toyz
Farmington Hills, Michigan
 
We are calling the exe as "DO exename". My understanding is that we would be running local instances of the the program; at least with the fxp files I'm all but 100% sure this is the case as we can run multiple instances of them simultaneously. Perhaps EXEs and FXPs differ in this regard?
 
Ok, I think I'll make a "program that calls a program with the RUN command so that Windows is handling it.

Mike,

That last tidbit is interesting. So, instead of running as:

"DO fxpname"

You're saying I'm better off making one big fat exe and getting at the programs via a passed parameter like:

"Do exename with fxpname"

Correct?
 
Another way to go about using a loader/launcher that I use just reads a file - such as 'launcher.ini' - and runs the listed executable. That way, you can create another version of the executable and just change the .ini file to reflect the new name. The next time the user runs the application, they run the listed executable:

Code:
IF !FILE('launcher.ini')
   MESSAGEBOX('LAUNCHER.INI missing')
   RETURN    
ENDIF

DECLARE INTEGER ShellExecute IN shell32.DLL ;
   INTEGER hndWin, ;
   STRING cAction, ;
   STRING cFileName, ;
   STRING cParams, ;
   STRING cDir, ;
   INTEGER nShowWin

CREATE CURSOR ini (cString c(40))
APPEND FROM launcher.ini SDF 

SCAN
   cTempStr = ALLTRIM(ini.cString)
   DO CASE
      CASE 'EXENAME' $ UPPER(cTempStr) 
         *... actual exe to run
         STORE ALLTRIM(SUBSTR(cTempStr, AT('=', cTempStr)+1 )) TO cExeName
         ShellExecute(0, "open", cExeName, '', '', 9)

      CASE &&... other stuff you may want to handle

   ENDCASE
ENDSCAN

USE IN ini
RETURN

In the launcher file:
Code:
EXENAME=MyApp1.exe


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top