autoupgrader TacAutoUpgrader component
Hierarchy Properties Methods Events Info-file
Return to Introduction  Previous page  Next page
The AutoUpgrader component used for automatic update from the Web any Delphi/BCB application. The AutoUpgrader will check your website out for the newest releases of your software and, if the newest versions is available — download updates and upgrade your application "on the fly". All this without a SINGLE LINE of code!  
The AutoUpgrader Pro (included to AppControls pack) contains built-in Application Update Wizard (screenshot #1), built-in multi-language support (it automatically recognize language used on user's PC and show all messages in native language (screenshot #2)). Current version automatically translates all wizard's content to more than 25 languages: English, Spanish, German, French, Russian, Portuguese, Italian, Dutch, Danish, Finnish, Catalan, Chinese, and many others. However, if you don't want to use built-in Wizard, you can make customized progress-dialogs using numerous events.  
When AutoUpgrader download files it automatically detects all Internet settings for current connection, pre-configured in the Control Panel. However, you still can use own settings, specifying preferable proxy-server or using direct connection.  
If you store newer version of your program in password protected Web directories, you can pre-configure the username/password to access files, or let AutoUpgrader to ask login information when it necessary (screenshot #3).  
When you release new version of your software — just create so-called InfoFile (which contains the upgrade information; you can create it manually or using built-in designer (screenshot #4)), then upload this file to your website.  
With AutoUpgrader your customers will use only latest versions of your software!  

How to use ?
First you need to create small file which contains the upgrade information (aka Info-file). You can create it by hands, using any text editor a'la NotePad, or using built-in InfoFIle Designer (double click the "InfoFile" property in Object Inspector to invoke it). As already mentioned, this file contains the upgrade information about your program. There listed all files (their location in the Web) which need to be downloaded and replaced/updated locally and the special constant which identifies the latest version of your program (see VersionNumber or VersionDate properties).  
Upload the Info-file to your website and point its location in the InfoFileURL property.That's all! Every time on detecting the Internet connection (see AutoCheck property), or when you call the CheckUpdate method, the AutoUpgrader will read the upgrade information file from your website and, if newer release of your application is available, it will try to automatically upgrade itself.  
Since you can specify many files in the download queue, by default they all want to be downloaded and updated when new version available (version date or number changed in the Info-file). However, if you set MiscFilesUpgrade property to mfuOnlyIfSizeDifferent, the AutoUpgrader will automatically compare the sizes of remote and local files to decide whether this file really should be updated or not. Alternatively you can use OnFileStart event to receive brief information about the file in download queue (it's size and date/time of last update) and decide whether you want to download it or not.  
new! The AutoUpgrader can download files to different specified locations, not only to main program directory. You can specify the location where downloaded file should be stored in the Info-file. The URLs in the Info-file listed as:  
In previous versions these files (myfile1.exe, myfile2.dll and myfile3.doc) could be downloaded only to the main program directory (where an EXE are running). In current version you can specify separate locations to each file, if required, after next "=" character. For example:  
So, the "myfile2" will be stored to the Windows\System directory (Windows\System32 for NT-family machines), and myfile3 will be downloaded to the subfolder named "docs", under main program directory (alternatively you can specify "%current%\docs\myfile3.doc" after "=" sign).  
The AutoUpgrader supports following "keywords" for system directories:  
%desktop%Desktop folder (for example, "C:\Documents and Settings\Username\Desktop\")  
%mydocuments%My Documents folder (for example, "C:\Documents and Settings\Username\Desktop\My Documents\")  
%mypictures%My Pictures folder (for example, "C:\Documents and Settings\Username\Desktop\My Pictures\")  
%appdata%Application Data folder (for example, "C:\Documents and Settings\Username\Application Data\")  
%programfiles%Program Files folder (for example, "C:\Program Files\")  
%windows%Windows folder (for example, "C:\Windows\")  
%system%System folder (for example, "C:\Windows\system32\")  
%temp%Temporary folder (for exmple, "C:\Documents and Settings\Username\Local Settings\Temp\")  
%help%Help folder ("C:\Windows\Help\")  
%media%Media folder ("C:\Windows\Media\")  
%cursors%Cursors folder ("C:\Windows\Cursors\")  
%current%The main program directory, where application are currently running.  

Important note!
iiwarning C++ Builder programmers: Don't forget to add "INET.LIB" file (or "WININET.LIB" in C++ Builder 6 and higher, this file can be found in "..\CBuilderX\Lib" directory) to your project which uses the acAutoUpgrader. The INET.LIB contains the prototypes for required Internet routines from WinInet.DLL.  

How does it override old files with newer ?

The AutoUpgrader downloads all updated files to the application directory with "*.*.uTMP" extension. It also set for them "temporary" and "hidden" attributes, so user will not see those files.  
After successful downloading, the AutoUpgrader extracts so-called self-upgrading module (Upgrader4.exe, 9KB), which performs local updates to the TEMP directory, execute it then terminate the main app itself. The self-upgrading mechanism replaces all files with newer ones and restarts the main application.  
See also the description of the self-upgrading mechanism, or check out the "Upgrader4.pas" file included to the package, if you purchased the AutoUpgrader or AppControls pack with source code.  
tip If you don't want to replace files by AutoUpgrader, you can use external self-extracting archives or setup-files which can extract files locally in "silent mode" (see description of RestartParams property for more details).  
iiwarning Note: If you wish to use AutoUpgrader for downloading just single setup-file which will perform all further updates — make sure that UpgradeMethod = umUseExternalSetup. Otherwise the self-upgrading module will replace your program with downloaded setup.  

Usage example
In Delphi:  
In C++ Builder:  
Compiled executable:  

See also
acHTTP and acThread components.