Outline of operation | High-level WebUpdate API | Where to find Tarma WebUpdate | System requirements | Reference
Tarma WebUpdate (TWU) is a dynamic link library (DLL) that enables you to perform automatic software updates from your applications. It offers the following functionality:
To use the Tarma WebUpdate functionality in your own application, you must add some application-specific code that uses the Tarma WebUpdate (TWU) routines. In addition, you must provide the following:
Tip: The easiest way to generate a package information file that describes your application and its installer is to use the Generate TWU update file option on the Build - Advanced page of your Build Configuration.
During a typical Tarma WebUpdate session, the following actions take place:
The Tarma WebUpdate sample application demonstrates how to use the Tarma WebUpdate functionality.
For the benefit of users who do not need (or through their choice of programming language, cannot easily access) the flexibility of the standard TWU functions, we offer a simplified set of high-level functions that implements the most common update scenario. Internally the high-level functions use the regular TWU API, but they take care of most implementation details such as callback functions for you.
With the aid of the high-level functions, the outline of the code that you must add to your own application is as follows (error handling omitted for clarity):
TWUPDATE hUpdate;
BOOL bUpdateAvailable;
hUpdate = TWUOpenUpdate(GetMainHwnd());
TWUCheckUpdate(hUpdate, _T("http://www.yourdomain.com/update.txt"), NULL, 0, &bUpdateAvailable);
if (bUpdateAvailable)
{
TWUDownloadUpdate(hUpdate, 0);
TWUInstallUpdate(hUpdate, 0);
TWURegisterRestart(hUpdate, NULL, NULL, TWU_UFLAGS_CLOSEMAIN); // See Note 3
}
TWUCloseUpdate(hUpdate);
// In case of an in-place update, call this after the next startup:
TWUCleanupUpdate();
IntPtr hUpdate;
Boolean bUpdateAvailable;
hUpdate = TWU.OpenUpdate(this.Handle);
TWU.CheckUpdate(hUpdate, "http://www.yourdomain.com/update.txt", "", 0, out bUpdateAvailable);
if (bUpdateAvailable)
{
TWU.DownloadUpdate(hUpdate, 0);
TWU.InstallUpdate(hUpdate, 0);
TWU.RegisterRestart(hUpdate, "", "", 1); // See Note 3
}
TWU.CloseUpdate(hUpdate);
// In case of an in-place update, call this after the next startup:
TWU.CleanupUpdate();
For more information about the high-level API, use the links in the following table.
| Name | Description |
|---|---|
| TWUCheckUpdate | Contacts your server to check for updates |
| TWUCleanupUpdate | Performs clean-up actions after application restart |
| TWUCloseUpdate | Ends the update process and optionally restarts your application |
| TWUDownloadUpdate | Downloads the update, if any is available |
| TWUGetUpdateName | Returns the name of the update, if any |
| TWUGetUpdateVersion | Returns the version of the update, if any |
| TWUInstallUpdate | Installs the update that was downloaded, if any |
| TWUOpenUpdate | Start the update process |
| TWURegisterRestart | Registers your application for a restart following an update |
The Tarma WebUpdate components are installed along with the rest of Tarma Installer. The following files are used with Tarma WebUpdate (all files and folders are relative to the Tarma Installer TWU installation folder, typically C:\Program Files\Tarma Installer 5\WebUpdate).
*Note: Files marked * are redistributables. If you are a registered user of Tarma Installer, then you may redistribute these DLLs with your own applications. The remaining files may not be redistributed.
| Folder | File | Description |
|---|---|---|
| Bin\ | TWU2009ai.dll* | Tarma WebUpdate DLL, 32-bit ANSI version. |
| TWU2009aid.dll | Tarma WebUpdate DLL, 32-bit ANSI Debug version, for testing only. | |
| TWU2009ui.dll* | Tarma WebUpdate DLL, 32-bit Unicode version. | |
| TWU2009uid.dll | Tarma WebUpdate DLL, 32-bit Unicode Debug version, for testing only. | |
| BinX64\ | TWU2009ui.dll* | Tarma WebUpdate DLL, x64 Unicode version. |
| TWU2009uid.dll | Tarma WebUpdate DLL, x64 Unicode Debug version, for testing only. | |
| Include\ | TWU.cs | C# class definition that defines the Tarma WebUpdate functions (high-level API only). You must include this file in your own C# project to use the Tarma WebUpdate functionality. |
| TWU.h | Header file that defines the Tarma WebUpdate functions and data structures. You must #include this file in your own C/C++ project to use the Tarma WebUpdate functionality. | |
| TWU.pas | Unit file for Borland Delphi that defines the Tarma WebUpdate functions and data structures. You must add a uses TWU clause to your own Delphi source files to use the Tarma WebUpdate functionality. | |
| TWUDefs.h | Base declarations for Tarma WebUpdate, automatically #included by TWU.h | |
| Lib\ | TWU2009ai.lib | 32-bit ANSI import library for Tarma WebUpdate. |
| TWU2009aid.lib | 32-bit ANSI import library for Tarma WebUpdate, Debug version. | |
| TWU2009ui.lib | 32-bit Unicode import library for Tarma WebUpdate. | |
| TWU2009uid.lib | 32-bit Unicode import library for Tarma WebUpdate, Debug version. | |
| LibX64\ | TWU2009ui.lib | x64 Unicode import library for Tarma WebUpdate. |
| TWU2009uid.lib | x64 Unicode import library for Tarma WebUpdate, Debug version. | |
| Samples\ | WebUpdate\*.* | Source code for the Tarma WebUpdate sample application that demonstrates how to use the Tarma WebUpdate functionality. It includes Microsoft Visual C++ 6 and Microsoft Visual Studio 2003 project files to build the sample application. It also includes a Borland Delphi sample application with equivalent functionality. |
Tarma WebUpdate has the following system requirements:
To build an application that uses Tarma WebUpdate, you will need the a Microsoft Visual C++ compiler (6.0, 2002, 2003, 2005, 2008) and the files mentioned above. You can use either the ANSI or the Unicode versions of the TWU entry points.
Refer to the following topics for more information about the various functions and types.
| Name | Description |
|---|---|
| fTWUCallback | General event/progress callback function prototype |
| fTWUPackageCB | Callback function prototype for use by TWUEnumPackages and TWUEnumPackageDependencies. |
| TWUCheckUpdateVersion | Compares the file version of a local file against the version of an update package. |
| TWUCleanupDownloads | Deletes all downloaded files. |
| TWUCloseSession | Closes an update session. |
| TWUCompareVersions | Compares two version numbers. |
| TWUDebugPrintf | Prints a formatted string in the debugging log file. |
| TWUEnumPackageDependencies | Enumerates the dependencies of a package. |
| TWUEnumPackages | Enumerates the packages in the package information file. |
| TWUFindInstalledInfo | Retrieves the installation information of a currently installed application. |
| TWUFindPackage | Finds a package by name. |
| TWUGetErrorMessage | Retrieves a Win32 error message text. |
| TWUGetEventArg | Returns a pointer to an additional event callback argument. |
| TWUGetPackage | Returns a package by index. |
| TWUGetPackageCount | Returns the number of packages in the package information file. |
| TWUGetPackageInstaller | Downloads a package installer. |
| TWUGetPIF | Retrieves and parses a package information file. |
| TWUGetVersionInfo | Get the fixed VERSIONINFO for a file. |
| TWUInstalledInfo | Defines the installed product information returned by TWUFindInstalledInfo. |
| TWUOpenSession | Opens an update session. |
| TWUOpenUpdateURL | Opens an update session and downloads a package information file. |
| TWUPackageData | Defines the package information. |
| TWUParseVersion | Parse a version string into a numeric version number. |
| TWURegisterCallback | Registers an event/progress callback function |
| TWURunPackageInstaller | Executes a downloaded package installer. |