Click here to Skip to main content
15,867,686 members
Articles / Desktop Programming / MFC
Article

Updater

Rate me:
Please Sign up or sign in to vote.
4.92/5 (133 votes)
6 Sep 2006CPOL18 min read 1M   19.3K   512   482
This updater makes it possible to update your application easily with data in XML format. This way, you don't have to write your own updater.

Slow download?

If you can't download the files here, please visit my website. The files are located there too. All the software on my website is free.

Image 1

Contents

Introduction

Updater is an application which enables the user to check if there is a new version of your application. If there is a new version, Updater will download the newest version and install it for you. This way, you don't have to write an updater module for your application yourself!

Which Download Do I Need?

As you can see, there are several files that you can download for the Updater. Some of them are small, and some are very large. Check here to find out which download you need:

Package nameDescription
Compiled projectThis is the most complete project. It includes the executable, source files, resource files, user guide, and screenshots. Normally, you can pick this download. If you want additional languages, you also need the language pack.
Language packThis is a separate download, because when a language is added, users don't want to download the complete package. This file includes only the language DLLs. The file is located on my website.
Source filesIf you think the compiled project is too big, you can download only the source files. There is no user guide included in this version.

Features

Here are the key-features of the Updater:

  • Selective updates to enable updating only small parts of an application;
  • Event-driven, so after every event, custom actions can be performed;
  • Run-time switching between user interfaces;
  • Update rollback to restore the application to the original state when the update is cancelled or when an error occurs;
  • Full proxy support;
  • Restore older versions of an application, even a month after updating;
  • Software protection to make sure only registered users can update your software (optional);
  • Actions that Updater can perform:
    • Download;
    • Backup;
    • Copy;
    • Run;
    • Delete;
    • Unzip;
    • Modify INI files;
    • Modify registry files;
    • Register system files;
  • Multilingual, languages are loaded automatically;
  • And a lot more!

Architecture

In this part of the article, I will try to explain how the Updater works, and explain why it is so extensible. The best way to explain the architecture is by using an image of the architecture:

Image 2

First, the Updater initializes itself and creates the needed directories for the Updater. It also loads a language file and starts a log file.

After the creation of the Updater, the main process is starting a user interface. What kind of user interface is loaded is not important for the main process, because all user interfaces receive the same messages and respond in the same way. The user interface decides whether the user can interact with the Updater or not. The user interface informs the main process that it is ready to start the next task. The user interface cannot decide which task is to be started. The main process knows which task is coming next.

The main process starts a new thread with the new task. This task will calculate all the actions necessary and start performing the actions. Again, it is not important what kind of task is started, because all these tasks receive the same messages and send the same messages. The task itself decides if the user should see a progress update or not, by sending update progress messages with status information. After a task is finished, the task will send a message to the main update process.

These steps are repeated until all the tasks are finished. After finishing all the tasks, the user interface will send a message that the user wants to end the application by sending it a thread message.

Finally, the main process will clean up all the objects and remove the folders. The language DLL is released and the log is closed. Finally, it closes the complete application.

As you can see, the Updater is very flexible because all these actions and user interfaces receive and send the same messages. This way, it is very easy to implement a new user interface in just a few minutes. Most of the time is spent in designing the new user interface.

Also, adding a new task is very easy because other tasks in the Updater don't have to be edited. I hope this part of the article helped you understand the architecture, technique, and the code of the Updater. If you have any questions, use the forum below.

File Locations

The Updater needs some different files to work correctly. A list of the available files:

  • Settings file
  • Update file
  • Sections file
  • Self update file

The files should be located as shown here:

Image 3

Sequenced Updating

It is possible to update a product in sequences. This means the user can be obligated to update from version 0.1 to 0.4 in sequences. An example is shown in the image below:

Image 4

To use sequenced updating, all update files (also the older versions) should be located on the server. The Updater will first read this part of the update file. If the current application version does not match at least the minimum version in the update file, the Updater will download the file located at the location element. This way, it is possible to create a chain of update files, which will lead to the very first update which has no sequence fields, or where the current application version matches the minimum version field.

Updater Tool

There is a tool developed for the Updater so that the users can easily create and manage the Updater files which are in XML format. The tool is available on my website.

Supported Languages

There are a lot of languages officially supported by the Updater. Please check out my website to view the actual list of languages supported.

Screenshots

Full Mode

Welcome Screen

Image 5

Here, you can see the welcome screen. This screen explains to the user what the Updater is going to do.

Check for New Version Screen

Image 6

In this screen, the Updater checks for a new version. If there is a new version, it will be noticed. If there is no new version, a message is shown to the user, and the Finish button appears.

HTML Message Screen

Image 7

In this screen, it is possible to show the product/company information. This screen is optional, so it is not needed to add an HTML message.

License Screen

Image 8

In this screen, the user must agree to the license. This screen is optional, so it is not needed to add a license.

Select Update Screen

Image 9

In this screen, the user is able to select the updates he/she wants to install.

Download Screen

Image 10

In this screen, the Updater downloads all the files needed for the updating process. The user can always cancel the operation. Also, all the errors will be caught and shown to the user.

Install Screen

Image 11

In this screen, the Updater executes all the actions needed for the updating process. The user can always cancel the operation. Also, all the errors will be caught and shown to the user.

Finish Screen

Image 12

This screen shows the message "ready updating" to the user.

Rollback Screen

Image 13

This screen shows the progress of the rollback task.

Silent Mode

Download Screen

Image 14

This screen shows an example of a notification to the user. As you can see, the download has just started. The user can always cancel the actions by right-clicking on the icon and choosing Exit.

Finish Screen

Image 15

This screen shows an example of a notification to the user. Now, it shows that the update process is ready. A new version is installed, and it is succeeded (see icon). The user can exit the Updater by right-clicking on the icon and choosing Exit.

Restore Screen

Image 16

This shows the screen that will help the user to restore an older version of a product.

Version History

The current version is 0.8.1.6.

Updater v 0.8.1.6

  • Manual
    • v0.8.1.5
  • Language pack
    • v0.8.1.5
  • Added/fixed
    • Fixed bug when reading a not-encrypted update file.
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.8.1.5

  • Manual
    • v0.8.1.5
  • Language pack
    • v0.8.1.5
  • Added/fixed
    • Added new option for closing application (user) so user can close the application by himself.
    • Updater can't be started anymore when no user is logged in to Windows.
    • Replaced ARACrypt encryption with Rijndael encryption.
    • Fixed some bugs when using CLOSEAPPLICATION.
    • Fixed bug when writing data to the registry.
    • Fixed bug that some people were not able to download files.
    • Fixed bug when a custom settings file is used, the version is written to the custom settings file instead of the default one.
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.8.1.4

  • Manual
    • v0.8.1.3
  • Language pack
    • v0.8.1.3
  • Added/fixed
    • Fixed bug when using CloseApplication
    • Fixed unzipping bug
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.8.1.3

  • Manual
    • v0.8.1.3
  • Language pack
    • v0.8.1.3
  • Added/fixed
    • Settings file can be located anywhere when the -settingsfile parameter is used.
    • Temporary update files are deleted after a successful update.
    • Application will be restarted when a rollback is performed, but only when the application should start after a successful update.
    • (Local) relative paths are now supported.
    • Windows 98 is now supported.
    • Added new setting (application root, see user guide for more details).
    • Added new constants (%updateserverpath%, %updateserverfile%, and %approot%).
    • Section files are now named with the application name. This makes it possible to use one update executable for multiple applications.
    • Updater is now Unicode compatible.
    • Improved user guide, an example of server file lay-out is added.
    • Section file is only written to the application folder when settings are really used.
    • Version numbers without sub numbers (i.e., 1 instead of 1.1) are parsed right so they can be used without any problems.
    • Other applications are closed properly now.
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.8.1.2

  • Manual
    • v0.8.1.2
  • Language pack
    • v0.8.1.2
  • Added/fixed
    • Added log viewer so the log file can be viewed by simply using the -log parameter.
    • Added the %windowsdirectory% constant.
    • Added download destination field.
    • Added new parameter -checkforupdates which checks for new updates in hidden mode.
    • Proxy password can now be stored in the settings file.
    • HTTPS is now supported.
    • The status of the file is stripped in the information, warning, and error dialogs.
    • Extended log information.
    • All dialogs now support ClearType.
    • User guide is rewritten and improved.
    • Uses a new version of the unzip library, which includes some bug fixes.
    • Improved user interface on non-Windows XP machines.
    • Fixed dial-up issue, this also works if you have two connections, e.g., dialup and wireless through proxy.
    • Fixed close-application bug.
    • Fixed registry bug.
    • Fixed some internet connection bugs.
    • Fixed bug when an invalid URL was used as the update location.
    • Fixed bug that hyperlinks look blurry when using ClearType.
    • Fixed several bugs in silent, verysilent, and hidden modes.
    • Fixed bug when parsing parameters.
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.8.1.1

  • Manual
    • v0.8.1.1
  • Language pack
    • v0.8.1.1
  • Added/fixed
    • Improved download resume;
    • Improved FTP, HTTP, and network downloads;
    • Improved user interface;
    • Renamed all the parameters for Updater;
    • Fixed bug when registering OCX files;
    • Added new event action: show notifier;
    • Fixed bug when the update file is encrypted;
    • Fixed bug when canceling an update;
    • Thanks to François Le Luhern, a lot of features have been improved;
    • Added manual proxy settings - still in beta phase;
    • When the Updater runs in silent mode and has no custom popup menu items, it will finish and close automatically when the install is finished;
    • Hyperlink colors can be customized now;
    • Removed custom language file;
    • Converted language format from DLL to XML;
    • Added select language dialog;
    • Removed the OnOpen event since it was useless;
    • XML tags can now be used as data without any problems;
    • A lot of minor bug fixes;
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.7.1.2

  • Manual
    • v0.7.1.2
  • Language pack
    • v0.7.1.2
  • Added/fixed
    • Improved download resume;
    • Improved FTP, HTTP, and network downloads;
    • Renamed all the parameters for Updater;
    • Fixed bug when registering OCX files;
    • Added new event action: show notifier;
    • Fixed bug when the update file was encrypted;
    • Thanks to François Le Luhern, a lot of features have been improved;
    • Added manual proxy settings - still in beta phase;
    • When the Updater runs in silent mode and has no custom popup menu items, it will finish and close automatically when the install is finished.
  • To-do
    • Enhance FTP support;
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not the one immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine.
  • Known bugs
    • Nil

Updater v 0.7.1.1

  • Manual
    • v0.7.1.1
  • Language pack
    • v0.7.1.1
  • Added/fixed
    • Updater can now restart the system after update;
    • Updater can now close any application at all the events;
    • Fixed some memory leaks;
    • User can be forced to update an application;
    • Fixed bug that wrong page is displayed when the user presses cancel;
    • Check connection is disabled by default since this version;
    • When using close action at AfterInstall event, the Updater did not finish the update properly. The bug is fixed;
    • Updater switched to full mode on HTML message, license and Select Update. If you want Updater to change to full mode, use the event action setmode on the events to set the mode, because Updater will not change the UI automatically anymore;
    • Fixed bug that the Updater started installing too quick after closing the application;
    • Added several new path variables;
    • Added shortcuts support;
    • A type for registry items can now be specified;
    • Added software protection mechanism;
    • Added new file action -> register files;
    • Added customizable popup notify for silent mode;
    • Added a method to use different update files for different product editions;
    • Added option to add bitmaps to popup menu;
    • Extended log function, parsing of update file is completely logged so errors can be found more easily;
    • Added restore feature, to restore an older version of the product;
    • Fixed bug that sections could not be disabled;
    • Fixed bug that the Updater crashed when user cancels receiving the update file;
    • When user presses cancel before the download action, rollback will not be enabled anymore;
    • Fixed some minor bugs;
  • To-do
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not immediately to the current version;
    • Add scripting engine;
    • Add user data collection;
    • Add skinning engine;
  • Known bugs
    • Nil

Updater v 0.6.3.2

  • Manual
    • v0.6.3.2
  • Language pack
    • v0.6.3.2
  • Added/fixed
    • Improved confirmation screens. Updater will explain why the user must confirm to file deletion, application closing or stop updating, with a nice user interface;
    • Improved error screens. Updater will explain what happened and what the user can do about it in the future to prevent it from happening, again with a nice user interface;
    • Constants can be used in other constants too. However, the constants used must be declared first;
    • When user was able to choose not to delete file, Updater froze. This bug is fixed;
    • When file cannot be deleted, Updater will continue updating;
    • Added new event action: start next task. This is useful when install should begin immediately after downloading;
    • Files can be checked by hash too (only when using check separately);
    • Updater will not stop updating when trying to download a 0 byte file;
    • It is now possible to encrypt the update file using Updater tool;
    • Updater can now load future language files. Previously, you needed the exact language file version;
    • Self-update location can now be specified without rebuilding Updater;
    • Updater will not fail anymore when gvhsoftware.org is not reachable and self-update is enabled;
  • To-do
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not immediately to the current version;
    • Added registration and license management feature.
  • Known bugs
    • Nil

Updater v 0.6.3.1

  • Manual
    • v0.6.3.1
  • Language pack
    • v0.6.3.1
  • Added/fixed
    • Added new feature (HTML message) so company or product information can be shown to the user as an HTML page;
    • Added sequenced updating (see user guide for more details);
    • Fixed version checking mechanism. Only versions with dots (.) could be parsed. Thanks to Steve Greaves, it is possible to use a lot of characters (. , | - _) in the version strings;
    • When Updater can't connect to www.gvhsoftware.org to check for self-update, update will still continue;
    • Fixed bug that system tray showed install progress while update was already finished;
    • When switching from silent to full mode, Updater is now set as active (front) window;
    • When running in silent mode and using sections, all the sections were added twice, this bug is fixed;
    • Sometimes Updater did not load the right page when the user clicked Cancel, this bug is fixed;
    • Optimized event handling;
    • Added option to disable proxy support;
    • Added new parameters (checkconnection and enableproxy);
    • It is now possible to add hyperlinks to new features to give the user more information about a specific feature;
    • It is now possible to add hyperlinks to sections to give the user more information about a specific section;
    • In the section screen, the title and the description of the first section are displayed automatically;
    • Some minor bug fixes and improvements.
  • To-do
    • Sequenced updating should calculate which actions should be taken so there is only one update needed, while in real, more updates are needed. Currently, the user can update only the next version, not immediate to the current version.
  • Known bugs
    • Nil

Updater v 0.6.2.3

  • Manual
    • v0.6.2.3
  • Language pack
    • v0.6.2.3
  • Added/fixed
    • Proxy authentication support added, all proxies can be passed now;
    • Fixed connection timeout;
    • Sections can now be disabled.
  • To-do
    • Develop tool for creating the XML-files.
  • Known bugs
    • Nil

History

  • August 24th, 2006
    • New version (0.8.1.6) of Updater released!
    • New version (0.4.1.2) of Updater tool released!
  • March 24th, 2006
    • New version (0.8.1.2) of Updater released!
    • New version (0.3.0.1) of Updater tool released!
  • January 31st, 2006
    • New version (0.8.1.1) of Updater released!
    • New version (0.3.0.0) of Updater tool released!
  • December 24th, 2005
    • New version (0.7.1.2) of Updater released!
    • New version (0.2.0.2) of Updater tool released!
  • October 10th, 2005
    • New version (0.7.1.1) of Updater released!
    • New version (0.2.0.1) of Updater tool released!
  • August 18th, 2005
    • New version (0.6.3.2) of Updater released!
    • New version (0.2.0.0) of Updater tool released!
    • Cleaned up the article and added architecture overview.
  • August 5th, 2005
    • New version (0.6.3.1) of Updater released!
    • New version (0.1.0.1) of Updater tool released!
  • July 13th, 2005
    • New version (0.6.2.3) of Updater released!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionLanguage files ? Pin
SebCanet3-Apr-18 9:28
SebCanet3-Apr-18 9:28 
AnswerRe: Language files ? Pin
SebCanet14-Apr-18 0:20
SebCanet14-Apr-18 0:20 
QuestionDoes anyone have the updater tool? Pin
ZdeamonTheMaster10-Jan-17 16:00
ZdeamonTheMaster10-Jan-17 16:00 
QuestionUpdater Tools Pin
AlejandroADVL5-Jul-15 13:25
AlejandroADVL5-Jul-15 13:25 
QuestionCould you give me the UpDate Tool Pin
Member 1154005423-Mar-15 20:50
Member 1154005423-Mar-15 20:50 
Questionupdate.xml file Pin
Member 1129442616-Dec-14 23:39
Member 1129442616-Dec-14 23:39 
AnswerRe: update.xml file Pin
Member 1129442618-Dec-14 0:47
Member 1129442618-Dec-14 0:47 
QuestionCompilable version in Visual Studio Community Edition Pin
David O'Neil1-Dec-14 0:24
professionalDavid O'Neil1-Dec-14 0:24 
AnswerRe: Compilable version in Visual Studio Community Edition Pin
Geert van Horrik1-Dec-14 0:45
Geert van Horrik1-Dec-14 0:45 
GeneralRe: Compilable version in Visual Studio Community Edition Pin
David O'Neil1-Dec-14 0:47
professionalDavid O'Neil1-Dec-14 0:47 
GeneralRe: Compilable version in Visual Studio Community Edition Pin
Geert van Horrik1-Dec-14 0:53
Geert van Horrik1-Dec-14 0:53 
GeneralRe: Compilable version in Visual Studio Community Edition Pin
David O'Neil1-Dec-14 1:05
professionalDavid O'Neil1-Dec-14 1:05 
GeneralRe: Compilable version in Visual Studio Community Edition Pin
ehaerim25-Jul-15 22:28
ehaerim25-Jul-15 22:28 
QuestionThe source code can't work Pin
hwzhong2025-Nov-12 20:12
hwzhong2025-Nov-12 20:12 
QuestionHow to update silently? Pin
timnboys7-Apr-12 11:28
timnboys7-Apr-12 11:28 
AnswerRe: How to update silently? Pin
Geert van Horrik7-Apr-12 22:02
Geert van Horrik7-Apr-12 22:02 
Suggestionuse PADUpdater (a similar free updater) Pin
Matt Camp.25-May-12 19:28
Matt Camp.25-May-12 19:28 
QuestionHow download source? Pin
VISTALL30-Sep-10 1:20
VISTALL30-Sep-10 1:20 
AnswerRe: How download source? Pin
Geert van Horrik30-Sep-10 8:21
Geert van Horrik30-Sep-10 8:21 
GeneralRe: How download source? Pin
VISTALL30-Sep-10 11:18
VISTALL30-Sep-10 11:18 
GeneralUpdate Tool for create XML files Pin
grillide12-Apr-10 23:33
grillide12-Apr-10 23:33 
GeneralRe: Update Tool for create XML files Pin
Geert van Horrik12-Apr-10 23:36
Geert van Horrik12-Apr-10 23:36 
QuestionCan I use this source code in commerical software? Pin
cuteus100112-Apr-10 20:38
cuteus100112-Apr-10 20:38 
AnswerRe: Can I use this source code in commerical software? Pin
Geert van Horrik12-Apr-10 23:24
Geert van Horrik12-Apr-10 23:24 
QuestionWhere can I download? Pin
grillide9-Apr-10 4:30
grillide9-Apr-10 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.