Actual Updater

How to add an update feature to my program

To integrate the update functionality into your program, first, download Actual Updater and install it.

The Actual Updater package contains only two files: Updater.exe and Config.exe .

Updater.exe is the main updater program which is used for checking for updates:

Updater.exe

Updater.exe uses file "Updater.ini" (or "Uninstall.ini" in case you use Actual Installer to distribute your program) which contains information about your program: Name, Version, Product GUID, URL of Update Information File, etc..
These two files (Updater.exe and Updater.ini) must be located in your app's main folder:

Explorer

To create file "Updater.ini" and copy these two files into your app's folder use "Actual Updater Configuration Tool" (file Config.exe, see shortcut on Desktop).

NOTE: If you use Actual Installer to distribute your program, then you don't have to use the Configuration Tool to create Updater.ini file, as Actual Installer has the Actual Updater features built-in in its interface (Installation \ Updater). You may use the Configuration Tool for creating update.txt file.

ConfigAU.exe

Enter your Product Name, and select Main Executable file. If your app doesn't have main executable file, just select any file from the folder where your application is located. In this folder will be created the updater files.

In order to check for updates, the Updater.exe should know the currently installed version of the application. There a few methods to get this version:

What is GUID?
Product GUID is a reference number used as an identifier of your product.
Example: {FCB1CDDE-F768-4D43-B1A1-BC019502DBC5} is for Actual Updater
Most installers generate a unique product GUID for every application and write it to Registry during installation. Here is how to get it from some installers:
- Inno Setup: open script file and look for "AppId="
- NSIS: open script file and look for "!define MUI_PRODUCT"
- Actual Installer: see the section "General - Parameters"

Then select preferred options for the updater, and specify the URL of Update Information File (see below). After that, click "Generate Updater.ini".

Update Information File - is a plain text file (e.g. update.txt) that contains the information about new version: new version number and link to download this version:

1.2
http://www.mysite.com/myprogram.exe

You can create this file manually or by using "Actual Updater Configuration Tool". This file should be uploaded to your web server, so Updater.exe can access it. Example of update.txt file:
http://www.actualupdater.com/update.txt

Every time when you release a new version of your program, you should also update this file on your server.


How Does It Work?

When Updater.exe is launched (as auto-check for updates, as "Check for Updates" shortcut from "Start Menu \ You App" or from your app menu "Help \ Check for Updates"), Updater.exe does the following:
1. Reads the program info from Updater.ini and extracts the currently installed version of program (from Regsitry, Main Executable, or updater.ini);
2. Downloads the Update Information File (update.txt) from specified URL;
3. Compares new version number and currently installed version number of the program;
4. Prompts to download if it is newer or exits.


Options

Use Product Name as Updater Title - Instead of the text "Actual Updater" in the dialog / message titles, will be used your product name.

Allow users to change the updater options - Users will be able to disable / enable the automatic update function (and silent mode), change the update frequency.

Use Downloader - By deafult, new version links are opened in the default browser. Select this option to add the Downloader.exe file which downloads the new version and launches it automatically.

Update Main Executable - Select this option, if you distribute your application without an installer and for updating you just need to replace the main executable file with the new one. During the update process, the new main executable file will be downloaded and copied to the old version location.

Automatically check for updates - Select the preferred update frequency - on Windows startup, Once a Day, Once a Week, or Once a Month. 'On Windows startup' is performed via Windows Registry (Run section). Other feautures are performed via Task Scheduler. Default time of running Updater.exe is 09:00. You can change this time via Update Parameters.

Update Parameters - Specify additional parameters:
-allowsilentupdate - add this to allow users to enable / disable the silent mode for the auto updates
-taskparam[params] - Sets parameters for Task Scheduler, e.g. change the deafult time to 10:00: -taskparam[/ST 10:00]
-notaskwhenavailable - add this to remove the option "Run task as soon as possible after a scheduled start is missed" for Task Scheduler.


Command Line Parameters

By default, when Updater.exe starts with no parameters, it displays the Product Details window. To check for updates, a user should click the Check for Updates button.

Updater.exe supports the following command-line parameters (switches):

/S - checks for updates in the silent mode. Message only appears if an update is available. No other messages appear (including connection error). This switch is recommended to use when you want to check for updates when your application starts;

/A - automatically checks for updates when updater starts. Standard messages appear: an update is available or not, errors, etc. This parameter is recommended to use when calling Updater.exe from your program (e.g. from menu "Help \ Check for Updates").

Example: Updater.exe /A

/Q - quiet mode (super silent), no messages, only exit codes (see below);

The following switches are supported only by the Pro edition:

/O - Opens the Options dialog. If specifid "/O i", where i - is a number, then also sets the item of the option "Automatically Check for Updates": i = 0 sets "on Windows startup", i=1 - Every Day, i=2 - Every Week, i=3 - Every Month

/CHECKAUTORUN - Checks if the option "Automatically Check for Updates on Windows startup" is enabled (return code is 10) or disabled (return code is 11). Cannot be used with switch /S

/AUTORUNON i - Turns on the option "Automatically Check for Updates" - for i = 0 uses "on Windows startup", i=1 - Every Day, i=2 - Every Week, i=3 - Every Month

/AUTORUNOFF i - Turns off the option "Automatically Check for Updates" - for i = 0 uses "on Windows startup", i=1 - Every Day, i=2 - Every Week, i=3 - Every Month

/AUTORUNAPPOFF - Turns off the option "Automatically Check for Updates on %AppName% Launch"


You may add the feature to check for updates into your app's start section (use the /S switch), or add the menu "Check for Updates" into the app's menu Help (use the /A switch).

Here are some code examples on how to launch Updater.exe with switch "/A":

C++ Code:

#include "Shlwapi.h"

ShellExecute(NULL, NULL, "Updater.exe", "/A", NULL, SW_SHOWNORMAL);

Delphi Code:

//don't forget to include ShellAPI into USES section

ShellExecute(0, 'open', 'Updater.exe', '/A', nil, SW_SHOWNORMAL);

VB.NET: C#:

Process.Start("Updater.exe", "/A");

VB.NET: C#:

Dim pHelp As New ProcessStartInfo
pHelp.FileName = "Updater.exe"
pHelp.Arguments = "/A"
pHelp.UseShellExecute = True
pHelp.WindowStyle = ProcessWindowStyle.Normal
Dim proc As Process = Process.Start(pHelp)

C#:

string arg = @"/A";
string command = "Updater.exe";
ProcessStartInfo start = new ProcessStartInfo(command, arg);
start.UseShellExecute = false;
start.CreateNoWindow = true; // Important if you want to keep shell
window hidden
Process.Start(start).WaitForExit(); //important to add WaitForExit()

C++:

Process::Start("Updater.exe", "/A");


Exit Codes

Updater.exe returns the following exit codes:

0 - No updates available;

1 - Configuration file not found;

2 - Unable to read product details;

3 - Unable to connect to the update site;

4 - Incorrect update information file;

5 - Update available.


The Advanced features are available in the Actual Updater Pro edition. More information.