Thanks Erik, that was pretty much what I was looking for, but I didn't remember it copying an exe to a local hard drive. This approach will cause problems with "gcDefaultDir = SYS(5)+SYS(2003)" syntax because my code expects the exe to be setting under the main app directory on the network. Since our workstations have various drive letters mapped to the network drive where the app is installed and in which the exe is setting, and VFP doesn't support UNC, I'm stuck between a rock and a hard place on this approach. I'll have to see if I can make a work-a-round.
Thanks again,
Jerry
>>I searched the thread archive for the word 'stub' but could find what I was looking for.
>>A couple of years ago, or so, someone posted a method showing how one could recomplie an exe that was in use by someone else. Normally, one encounters a msg that says "File doesn't exit" if one attempts to compile to an exe that is being used.
>>
>
>We use something similar, but it requires that the exe live on the server, but is run from a local copy. Our "Launcher" is what all shortcuts point to. It takes the name of an exe in the command line, so your shortcut would look like:
>
>k:\applications\launcher "mydatabaseapp.exe"
>
>Launcher is a simple program- here it is in it's entirety:
>
>
>PARA tcExe
>
>lcExe = UPPER(tcExe)
>
>SET SAFE OFF
>lcLocalDir = LOCAL_DIR
>lcServerDir = SERVER_DIR
>lcServerFile = lcServerDir + lcExe
>lcLocalFile = lcLocalDir + lcExe
>
>IF !FILE(lcServerFile)
> MESSAGEBOX("File " + lcServerFile + " does not exist.", 48, "Launcher")
> RETURN .F.
>ENDIF
>
>IF !DIRECTORY(lcLocalDir)
> MD (lcLocalDir)
>ENDIF
>
>IF !FILE(lcLocalFile)
> CopyFile()
>ENDIF
>
>ltLocalFileTime = CTOT(DTOC(FDATE(lcLocalFile)) + " " + FTIME(lcLocalFile))
>ltServerFileTime = CTOT(DTOC(FDATE(lcServerFile)) + " " + FTIME(lcServerFile))
>
>IF ltServerFileTime > ltLocalfileTime
> CopyFile()
>ENDIF
>
>IF ltServerFileTime < ltLocalfileTime
> lnAnswer = MESSAGEBOX("The file " + lcLocalFile + ;
> " is newer than the file " + lcServerFile + ". Do you want to copy over the newer file?" + CHR(13) + ;
> "Server: " + TTOC(ltServerFileTime) + CHR(13) + ;
> "Local: " + TTOC(ltLocalFileTime), 4+32,"Launcher")
> IF lnAnswer = 6
> CopyFile()
> ENDIF
>ENDIF
>
>CD C:\VFPEXE
>RUN /N &lcLocalFile
>
>
>FUNCTION CopyFile
> WAIT WINDOW "Copying " + lcServerFile + " to " + lcLocalFile + "..." NOWAIT
> COPY FILE (lcServerFile) TO (lcLocalFile)
> WAIT CLEAR
>ENDFUNC
>
>
>
>It starts, checks the file times on both copies of the file, and if a newer one exists, copies it down. It then runs the exe from the local drive. This allows me to compile over the copy on the server at any time, and the next time the user starts the program, the latest version will be copied down.
Nebraska Dept of Revenue