>Currently I'm maintaining a VFP8 manufacturing application which compiles completely into a single executable. As the project has grown and is in a constant state of development, I'm wanting to break up the system into several modules to allow for easier updating during the work day. For example, if I'm trying to implement a new bill of materials report for our Manufacturing Dept, I'd rather not have to tell the Shipping Dept to exit the program so I can replace the EXE with the newest version.
>
>Fortunately, program is already divided cleanly by departmental function (Manufacturing, Shipping, Purchasing, etc.) and each module is already called from a master menu form. Can I "sub-compile" individual modules and run them with a DO command? If I run a DO EXE command, will global variables, etc., still pass through to the called EXE? If the user exits the called EXE will control return to the calling program?
>
>Obviously I've never done this and ANY recommendations would be appreciated.
>
>Thanks in advance.
>
>- Dean
Dean,
You can easily solve the exe problem with a loader. Replace your exe with a small loader. The loader (9-10k) will look whether there's a more recent app on the server, and if yes copy it to the local disk, and then execute the (copied) app
eg: \\Server\Program.exe (small loader), and users start in C:\LocalFolder\..
\\Server\Program.app ( your app instead of an exe)
(1) Make a loader.exe, code at the bottom
(2) rename loader.exe to your exe, eg program.exe
(3) instead of producing eg program.exe, produce program.app
(4) put the app on the server
(5) each time a user starts your exe, it will look for a newer app and copy it if necessary
I've been working like this for years and if I have a small change: I drop the new app on the network and tell the user involved to quit the app and restart the app.
procedure Loader()
lparameters _p01,_p02,_p03,_p04,_p05,_p06,_p07,_p08,_p09,_p10,_p11,_p12,_p13, ;
_p14,_p15,_p16,_p17,_p18,_p19,_p20,_p21,_p22,_p23,_p24,_p25,_p26,_p27
acti screen
_screen.Fontname = 'Courier New'
_screen.Fontsize = 10
set FullPath On
local StartupApp, LocalApp, cmd, i, n
n = pCount()
StartupApp = addbs(justpath(StartUpExe()))+juststem(StartUpExe())+'.app'
LocalApp = addbs(_vfp.DefaultFilePath)+juststem(StartUpExe())+'.app'
cmd = 'do ("' + LocalApp + '")'
for i = 1 to n
cmd = cmd + iif(i=1, ' with ', ',') + '_p' + padl(ltrim(str(i,4,0)),2,'0')
endfor
for i = n+1 to 27
release ('_p'+padl(ltrim(str(i,4,0)),2,'0'))
endfor
do case
case ( StartupApp == LocalApp )
otherwise
if( FileExists(StartupApp) )
if( FileExists(LocalApp) )
if( fdate(StartupApp,1) > fdate(LocalApp,1) )
delete file (LocalApp)
endif
endif
if( !FileExists(LocalApp) )
copy file (StartupApp) to (localApp)
endif
endif
endcase
if( !FileExists(LocalApp) )
=MessageBox('Cannot find ' + LocalApp, 0+16, JustStem(LocalApp))
return
endif
release StartupApp, LocalApp, i, n
&cmd
endproc
function StartUpExe()
do case
case ( ':' $ sys(16,0) )
return substr(sys(16,0), rat(':', sys(16,0))-1)
otherwise
return substr(sys(16,0), rat('\\', sys(16,0)))
endcase
endfunc
Function FileExists(FileName)
declare Integer GetFileAttributes in win32api string @
return (GetFileAttributes(@FileName) <> -1)
endfunc
Gregory