Recent

Author Topic: Help with creating a way to update a program  (Read 5503 times)

wpflum

  • Sr. Member
  • ****
  • Posts: 270
Help with creating a way to update a program
« on: June 14, 2011, 07:58:47 pm »
I guess I'm in the right forum since I'm dealing with a subject directly related to windows but if I'm not please forgive me and tell me where to go  :D

I have a small program I've designed to interface between Vendor software and our server that converts an xml file into a format our server can import.  I'm not finished and when I do roll it out I'm guaranteed ongoing format issues, do to vendors changing their formats, that I will need to fix and re-roll out to a bunch of PC's in different stores.  What I'd like to do is create something in code that will allow me to have the program check for updates when it is started up, download them and install them.  The program itself is very small, under 2 meg, and the install part is probably fairly simple since all I really have to do is replace it in the programs directory.  I'm pretty sure I can come up with some code to ping the server and look for a new file and download it but I'm not sure about how I'd go about replacing the current program without user intervention, especially while it is running. 

Anyone done something like this that could kick me in the right direction??? 

JD

  • Hero Member
  • *****
  • Posts: 1793
Re: Help with creating a way to update a program
« Reply #1 on: June 15, 2011, 03:57:03 am »
I'm pretty sure I can come up with some code to ping the server and look for a new file and download it but I'm not sure about how I'd go about replacing the current program without user intervention, especially while it is running.  

This is how I would do it:

1. Without user intervention
a) Create an updater application that runs on Windows startup on the client computers
b) Once it is running, it pings the server looking for a new file
c) If one is found, it downloads & overwrites the old file

The problem here is what happens when the user starts the user application before the update is completed? You'll have to add code to the user application that tests if an update is in progress & blocks the launch of the user application until the upgrade is finished.

2. With user intervention
a) On the client computers, check for updates to the application when the users start it or at specified intervals
b) If an upgrade exists, alert the user & ask if he wants to upgrade immediately
c) If the user clicked YES, close the program
d) Run the updater that downloads the upgrade, overwrites the old version of the application & restarts the application

I personally would hate that a program upgrades itself without my approval hence I would prefer option 2. But we all have our personal preferences.  :D


« Last Edit: June 15, 2011, 04:02:48 am by JD »
Windows (10, 7) - Lazarus 2.1/FPC 3.2, Delphi

Indy 10.6 series; mORMot; Zeos 7.3; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: Help with creating a way to update a program
« Reply #2 on: June 15, 2011, 04:12:01 am »
Hey wpflum,

as JD said, people don't like programs that update themselves ^^.

If you look at the source of the project lazpaint
https://sourceforge.net/projects/lazpaint/,

you will see i made an "update checker" for it. Quite simple.
But i'm working on a updater that would get the latest files from the net, and replace the application, then restart (or ask to restart).

So please keep in touch, or wait until i release it (it may take some weeks to finalize it) as i'm finishing other projects
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

wpflum

  • Sr. Member
  • ****
  • Posts: 270
Re: Help with creating a way to update a program
« Reply #3 on: June 16, 2011, 05:53:02 pm »
I could care less if employees don't like automatic updates, the employees have no say in the matter as this is used internally only.  I need to make it automatic so if I correct problems or make changes based on changes made by vendors or changes ordered by management then the employees will automatically be forced to update before being allowed to use the software. 

Now if I was writing something for the public I'd definitely use a non automatic updates since I also do not like the kind of software that forces me to update whether I want to or not but for in house company stuff there is no choice.
 

 

TinyPortal © 2005-2018