Friends,
would someone have an example of how to create a routine to update the executable of my application via FTP?
Friends,
would someone have an example of how to create a routine to update the executable of my application via FTP?
 // versie update controle
  if oRs:versie <> system_version
   if URLDOWNLOADTOFILE( 0, "http:\\<!-- m --><a class="postlink" href="http://www.yoursite.com/fivewin/program.exe">http://www.yoursite.com/fivewin/program.exe</a><!-- m -->", "update.exe" ) = 0
    oRs:versie = system_version
    oRs:Save()
    msginfo("Update gevonden")
   endif
  endif
You need this DLL function :
DLL FUNCTION URLDOWNLOADTOFILE( pCaller AS LONG, cUrl AS LPSTR, cFileName AS LPSTR, nReserved AS DWORD, nFnCB AS LONG ) AS LONG;
  PASCAL FROM "URLDownloadToFileA" LIB "urlmon.dll"Marc Venken, Thanks!
Gale FORd thanks!
![]()
SGS wrote:
would someone have an example of how to create a routine to update the executable of my application via FTP?
Sorry to weigh in late on this. I not only had the need to auto install updates, but I also wanted to do backups everynight of all the data on the machine, and submit data for 3rd party vendors used by the clients.
I built an "AutoUpdate" executable on the primary machine. Every 3 hours it queries our server to see if there is an update. It also downloads a "keyfile" from our server which has a file ( encrypted ) of clients, and their version authorizations. I also have a rental program, so it contains the shut off date it payments are not received ( or the new extended authorization date when they are ). In the middle of the night ( after midnight ) when people are not likely on the system, it creates a backup archive file ( zip ) which it saves to a specified destination ( usually an external drive ), and it submits data to those vendors. Finally, it also sends emails to clients based on settings in the system ( especially thank you notes and reminders ).
When a new update is available, it does have the same name as the client executable, but it is downloaded to a sub folder on the primary (server) computer. When a person starts the client on their workstation, it actually calls a "run" program which checks for new copies of the .exe and .chm files on the server, and copies them to the local machine. Then it starts the client executable.
This system has been in place for many years, and it works beautifully. Sometimes when adding a new capability to the software, it can take a few "fine tuning" updates ... and of course if there is an error, it can be fixed and made available immediately.
The auto updater runs 24/7 and right clicking on the icon will bring up a menu where the log can be displayed, and also a person can do an immediate update request. So, in our "real world" if someone finds a bug that interferes with their operations, calls it in at 8:00 am, by 8:10 it is fixed, a new .exe is built and pushed to the server, and they can manually request an update. Thus, they can be running bug free by 8:15. Since most bugs are typos, fixes are usually very fast, and this operation is very easy.
The actual code is rather simple ... just write it to generally avoid any screen displays so it is fast and efficient.
I've tried to build this as a windows service, and so far have not been successful. I believe it will happen in the near future, however, once I determine which library elements ( unused but present ) are blocking that ability.
Tim
it actually calls a "run" program which checks for new copies of the .exe and .chm files on the server, and copies them to the local machine. Then it starts the client executable.
Yes, it is an .exe that I created. It has more intelligence than a bat file ....
So, Your Run program on every client will call afther the update/copy the new version to launch. I suppose with a waitrun or so ?
But the Run program will also be running 24/7 or when do you close this?
What happens if the client closes your 24/7 update program. Your backup system will fail not ?
Marc,
The program on the server runs 24/7. If they turn it off, it obviously cannot work. However, when they turn it back on, it "catches up".
The desktop icon on the workstation points to the local update program. When someone exits the program, then restarts it, that is when it checks the server to see if there is a more recent copy of the main executable. If so, it copies it over. It also does the same with other files it checks for updated versions. Then it starts the program. This usually just takes a few seconds. Our clients do not keep the programs running when they leave at the end of the workday.
The bottom line is it works VERY WELL.
Tim
Carlos Mora,
Worked perfectly, thank you!
SGS wrote:Carlos Mora,
Worked perfectly, thank you!
Marc Venken,
http://bielsys.blogspot.com.es/2009/02/
Worked perfectly, I made some adjustments just to fit my specific needs. The original source code works perfectly.