Tips and Frequently Asked Questions
TimeOut & ReceiveTimeOut
First of all, TWebUpdate has a function .Connected: boolean that can return whether the PC is connected to the internet or not.
TimeOut:
Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to use for Internet connection requests. Setting this option to infinite (0xFFFFFFFF) will disable this timer.
ReceiveTimeOut:
Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to receive a response to a request. If the response takes longer than this time-out value, the request is canceled
Default values are zero, meaning , these values are not configured and system defaults are used.
How to update files inside a subfolder under the application folder
If you deployed under C:\Program Files (x86)\ there is no other choice than deploying this as application components (i.e. files should be in CAB and CAB should be listed under appcomps=... in the WebUpdate .INF control file) as typically, your installed app isn’t running with admin permissions to be able to write under the protected \Program Files folder.
How to target the UserAppData directory
There are several target directory options:
{WIN} : Windows folder
{SYS} : Windows System32 folder
{PF} : Program Files folder
{TMP} : Temporary files folder
{APP} : Application folder
{DOC} : My documents folder
In case you wish to target the UserAppData directory, you can do this with a custom path converter via event OnConvertPrefix.
From this event you can pass the path for a prefix you assign for this path where the path itself can be retrieved via:
uses ShlObj;
..
..
function getUserPath:string;
var pathString:array[0..1023] of char;
begin
ShGetSpecialFolderPath(0,PChar(@pathString),CSIDL_APPDATA,false);
result:=pathString;
end;
How to to turn off UAC prompt (registered version only)
Open WUPDATE.PAS and remove the line
{$DEFINE USEUAC}
in WUPDATE.PAS and it will be compiled with the resource that includes the updater that doesn't have the manifest
to force starting with UAC.
Including your company name in de dialog 'Do you want to allow the following program to make changes on this computer? Verified publisher: tmssoftware.com' when using TWebUpdate on Windows Vista / 7
To include your company name as the verified company you'll need to purchase a digital certificate and sign the spawned updater app with your own certificate. For the purchase of digital signatures we'd recommend to have a look at
GlobalSign.
Unfortunately this is not us enforcing this, this is Microsoft's security policy. It will only allow digitally signed executables to replace files under \Program Files folder.
The files you need + instructions to perform custom signing of the updater application are available upon email request.
Writing custom TWebUpdateWizard translation components
It is very simple to create a translated version of the TWebUpdateWizard by providing a TWebUpdateWizardLanguage component. To write a custom version, create a class that descends from TWebUpdateWizardLanguage, override the constructor and provided the translated texts.
As an example, this is the source code for the dutch translated version:
constructor TWebUpdateWizardDutch.Create(AOwner: TComponent);
begin
inherited;
Welcome := 'Druk start om te beginnen met controleren voor applicatie updates ...';
StartButton := 'Start';
NextButton := 'Volgende';
ExitButton := 'Verlaten';
CancelButton := 'Annuleren';
RestartButton := 'Herstarten';
GetUpdateButton := 'Update';
NewVersionFound := 'Nieuwe version gevonden';
NewVersion := 'Nieuwe versie';
NoNewVersionAvail := 'Geen nieuwe versie beschikbaar.';
NewVersionAvail := 'Nieuwe versie beschikbaar.';
CurrentVersion := 'Huidige versie';
NoFilesFound := 'Geen bestanden gevonden voor update';
NoUpdateOnServer := 'geen update gevonden op server ...';
CannotConnect := 'Er kan geen verbinding met de update server tot stand gebracht worden of';
WhatsNew := 'Nieuw in update';
License := 'Licentie overeenkomst';
AcceptLicense := 'Ik aanvaard';
NotAcceptLicense := 'Ik aanvaard niet';
ComponentsAvail := 'Beschikbare applicatie componenten';
DownloadingFiles := 'Downloaden bestanden';
CurrentProgress := 'Vooruitgang huidig bestand';
TotalProgress := 'Totale vooruitgang';
UpdateComplete := 'Update volledig ...';
RestartInfo := 'Druk Herstarten om de nieuwe versie te starten.';
WhatsNewPopup := ‘Bekijken met kladblok’;
LicensePopup := ‘Bekijken met kladblok’;
end;
Using TWebUpdateWizard
Using TWebUpdate with the TWebUpdateWizard is straightforward. Drop the TWebUpdate and TWebUpdateWizard on the form, setup TWebUpdate and assign TWebUpdate to the TWebUpdateWizard.WebUpdate property. The wizard can be started by calling TWebUpdateWizard.Execute.
Additional options for the TWebUpdateWizard are:
AutoRun: when true, does not require the user to step through each step
AutoStart: when true, the user does not have to start the update process, it starts automatically
Billboard: sets the left image for the update wizard dialog
BillboardCenter: Boolean: When true, the image is centered
BillboardStretch: Boolean: When true, the billboard image is stretched
BillboardTop: integer: sets the top position of the billboard image
BillboardLeft: integer: sets the left position of the billboard image
BillboardWidth: integer: sets the width of the billboard image
BillboardHeight: integer: sets the height of the billboard image
BorderStyle: sets the border style for the update wizard dialog
Caption: sets the caption text for the update wizard dialog
Font: sets the font for the update wizard dialog
Language: sets the language for the update wizard dialog. By default, the language is English.
Position: sets the screen position of the update wizard dialog
TWebUpdate Debugging
In case something is not working as desired, it is often convenient to check what steps TWebUpdate has executed. This can be traced by setting TWebUpdate.Logging = true.
During execution, TWebUpdate will create a log file of all steps performed in the file WUPDATE.LOG (default filename or can be changed with TWebUpdate.LogFileName)
If no path is specified, the log file will by default be created in the “My documents” folder.
When something doesn't work, you can always
contact our support team.
To have more insight in what exactly you're doing, send your INF file and the generated log file as well.
With this information, we should be able to see what exactly is missing.
Translate the dialog "Shutdown application to update executable files?"
Open WUPDENG.RC
Translate the message & recompile the .RC file to a .RES file with BRCC32.exe
Calculating checksums of files
To calculate the checksum of a file to put in the WebUpdate .INF control file, the function CRC32ChecksumOfFile can be used that is available in the unit wucrc32.pas.
Add this unit to the uses clause and use code:
var
checksum: integer;
begin
checksum := CRC32ChecksumOfFile('myfile.ext');
end;
Turn off dialogs during the update process
To turn off the dialog prompting to allow to proceed with the update and download updated files, set property WebUpdate.UpdateUpdate to wuuSilent.
Avoid the dialog "Shutdown application..." during updates
You can turn off that this dialog is displayed just before the application restarts by adding in the control .INF file following setting:
[application]
silentrestart=1
Using TWebUpdate with C++Builder
For C++Builder users, add following line in your app's main CPP file:
#pragma link "wininet.lib"
General tips
- When the update download is downloaded on the desktop or other folder than the folder where the application's EXE is located, make sure to use SetCurrentDir(ExtractFilePath(Application.ExeName)); before calling TWebUpdate.DoUpdate
- When the updated EXE is distributed as CAB file, make sure that TWebUpdate.CABExtract is set to false and that there are no identifiers compressed = 1 in the section for the application. It is the spawned updater app that needs to decompress the CAB file and not TWebUpdate in the application itself.