In the dwinshs.iss script, a pre-defined downloading wizard page can be used by you. Please follow the steps below to use it:
Copy the file dwinshs.iss to your installation script folder or a sub-folder in it.
Please define the DwinsHs_Use_Predefined_Downloading_WizardPage macro, then include the dwinshs.iss file at the beginning of the "[Code]" section. If the file is placed in the sub-folder of your installation scripts folder, please add path of the sub-folder in order to locate it. For exampe:
[Code]
#define DwinsHs_Use_Predefined_Downloading_WizardPage
......
#include "dwinshs.iss"
......
In the pre-defined downloading wizard page, the "DwinsHs_Auto_Continue macro before including the dwinshs.iss file, the Setup wizard will move to next wizard page automatically when download completed. For exampe:
" button will be disabled during downloading. It will be enabled when download completed, you can click on it to move to next wizard page. By define the[Code]
#define DwinsHs_Use_Predefined_Downloading_WizardPage
......
#define DwinsHs_Auto_Continue
......
#include "dwinshs.iss"
......
If you want to use the DwinsHs_RemoveAllRemoteFiles and DwinsHs_ResetAllRemoteFiles procedures, or the DwinsHs_RemoveRemoteFile, DwinsHs_ResetRemoteFile, and DwinsHs_RemoteFilesCount functions, please define corresponding macros before including the dwinshs.iss file: DwinsHs_Use_RemoveAllRemoteFiles, DwinsHs_Use_ResetAllRemoteFiles, DwinsHs_Use_RemoveRemoteFile, DwinsHs_Use_ResetRemoteFile, and DwinsHs_Use_RemoteFilesCount. For example:
[Code]
#define DwinsHs_Use_Predefined_Downloading_WizardPage
......
#define DwinsHs_Use_RemoveAllRemoteFiles
#define DwinsHs_Use_ResetAllRemoteFiles
#define DwinsHs_Use_RemoveRemoteFile
#define DwinsHs_Use_ResetRemoteFile
#define DwinsHs_Use_RemoteFilesCount
......
#include "dwinshs.iss"
......
Optional, you can specify the size of read buffer by defining the macro DwinsHs_Data_Buffer_Length before including the dwinshs.iss file. By default, it's 4096 bytes. For example:
[Code]
#define DwinsHs_Use_Predefined_Downloading_WizardPage
......
#define DwinsHs_Data_Buffer_Length 8192
......
#include "dwinshs.iss"
......
In the "[Files]" section, please add a "Check" parameter for each remote file which will be downloaded from remote server, and use the DwinsHs_check function as its value, in order to append them into the DwinsHs_DwonloadsList download queue. Also, please add the external value to the Flags parameter of the file entry. For example:
[Files]
...
Source: "{tmp}\main.dll"; DestDir: "{app}"; Flags: external; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\main.dll'), 'http://domain.com/main.dll', \
'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\ext.dll"; DestDir: "{app}"; Flags: external; Components: ext_a ext_b; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\ext.dll'), \
'http://domain.com/extension.dll', 'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\a.exe"; DestDir: "{app}"; Flags: external; Tasks: install_a; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\a.exe'), 'http://domain.com/a.exe', \
'My_Setup', 'Get', 0, 0 );
...
If an entry has contained the "Check" parameter, and you want to download it from the remote server, please concatenate its value and the DwinsHs_Check function using the and operator. For example:
[Files]
...
Source: "{tmp}\abc.dll"; DestDir: "{app}\abc"; Flags: external; \
Check: DirCheck( ExpandConstant('{app}\abc') ) and \
DwinsHs_Check( ExpandConstant('{tmp}\abc.dll'), 'http://domain.com/abc.dll', \
'My_Setup', 'Get', 0, 0 );
...
Please call the DwinsHs_InitializeWizard procedure in the InitializeSetup event function. If the event function isn't defined, please create it. For example:
procedure InitializeWizard();
begin
...
DwinsHs_InitializeWizard(wpPreparing);
...
end;
Please call the DwinsHs_ShouldSkipPage procedure in the end of the ShouldSkipPage event function. If the event function isn't defined, please create it. For example:
function ShouldSkipPage(CurPageID: Integer): Boolean;
begin
Result := False;
...
DwinsHs_ShouldSkipPage(CurPageID, Result);
end;
Please call the DwinsHs_BackButtonClick procedure in the end of the BackButtonClick event function. If the event function isn't defined, please create it. For example:
function BackButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
...
DwinsHs_BackButtonClick(CurPageID);
end;
Please call the DwinsHs_NextButtonClick procedure in the end of the NextButtonClick event function. If the event function isn't defined, please create it. For example:
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
...
DwinsHs_NextButtonClick(CurPageID, Result);
end;
Please call the DwinsHs_CancelButtonClick procedure in the end of the CancelButtonClick event function. If the event function isn't defined, please create it. For example:
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Cancel := True;
Confirm := True;
...
DwinsHs_CancelButtonClick(CurPageID, Cancel, Confirm);
end;
Please call the DwinsHs_CurPageChanged procedure in the CurPageChanged event function. If the event function isn't defined, please create it. For example:
procedure CurPageChanged(CurPageID: Integer);
begin
...
DwinsHs_CurPageChanged(CurPageID, nil, nil);
...
end;
Optional, you can use the BeforeDownload parameter to specify a BeforeDownload callback function when you make the DwinsHs_CurPageChanged procedure call, it will be called before the download starts. You can use the callback function to add new remote files to the DwinsHs_DwonloadsList download queue, or add mirror sources for every remote file. For example:
function BeforeDownload(): Boolean;
begin
...
DwinsHs_AppendRemoteFile( ExpandConstant('{tmp}\abc.zip'), 'http://domain1.com/abc.zip',
'My_Setup', rmGet, FILESIZE_QUERY_SERVER );
...
DwinsHs_AppendMirrorFile( ExpandConstant('{tmp}\abc.zip'), 'http://domain2.com/abc.zip',
'My_Setup', rmGet );
...
Result := True;
end;
...
procedure CurPageChanged(CurPageID: Integer);
begin
...
DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, nil);
...
end;
Also, You can use the AfterDownload parameter to specify a AfterDownload callback procedure when you make the DwinsHs_CurPageChanged procedure call, it will be called after the download completes. You can use the callback procedure to install the files downloaded jsut now, such as running a executable file, moving a file or extracting an archive to the application's folder. For example:
function BeforeDownload(): Boolean;
begin
...
DwinsHs_AppendRemoteFile( ExpandConstant('{tmp}\abc.dll'), 'http://domain1.com/abc.dll',
'My_Setup', rmGet, 0 );
...
DwinsHs_AppendMirrorFile( ExpandConstant('{tmp}\abc.dll'), 'http://domain2.com/abc.dll',
'My_Setup', rmGet );
...
Result := True;
end;
...
procedure AfterDownload(State: Integer);
begin
...
if State = READ_OK then
FileCopy( ExpandConstant('{tmp}\abc.dll'), ExpandConstant('{app}\abc.dll'), false );
...
end;
...
procedure CurPageChanged(CurPageID: Integer);
begin
...
DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
...
end;
If you want to create a multilingual installation package, please use the [Languages] section defines the languages to make available to it. See also the Inno Setup Help document. For example:
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "fr"; MessagesFile: "compiler:Languages\French.isl"
Then translate the following messages for every language, and add them into the [CustomMessages] section. Note, in the dwinsHs.iss script, the default custom messages are defined for the pre-defined downloading wizard page (it's written in English, so the English messages isn't required). In the multilingual installation package, for every language, if you don't define the custom messages for the pre-defined downloading wizard page, the default custom messages will be used.
DwinsHs_PageCaption =Downloading additional files
DwinsHs_PageDescription =Please wait while setup downloads additional files...
DwinsHs_TotalProgress =Total progress:
DwinsHs_CurrentFile =Current file:
DwinsHs_File =File:
DwinsHs_Speed =Speed:
DwinsHs_Status =Status:
DwinsHs_ElapsedTime =Elapsed time:
DwinsHs_RemainingTime =Remaining time:
DwinsHs_Status_ButtonRetry =&Retry
DwinsHs_Status_ButtonNext =&Next >
DwinsHs_SizeInBytes =%d Bytes
DwinsHs_SizeInKB =%.2f KB
DwinsHs_SizeInMB =%.2f MB
DwinsHs_ProgressValue = %s of %s (%d%%%)
DwinsHs_SpeedInBytes =%d Byte/s
DwinsHs_SpeedInKB =%.2f KB/s
DwinsHs_SpeedInMB =%.2f MB/s
DwinsHs_TimeInHour = %d hour(s), %d minute(s), %d second(s)
DwinsHs_TimeInMinute = %d minute(s), %d second(s)
DwinsHs_TimeInSecond = %d second(s)
DwinsHs_Status_GetFileInformation =Fetch file size
DwinsHs_Status_StartingDownload =Starting download
DwinsHs_Status_Downloading =Downloading
DwinsHs_Status_DownlaodComplete =Download complete
DwinsHs_Error_Network =No active Internet connection
DwinsHs_Error_Offline =The computer is in offline mode
DwinsHs_Error_Initialize =Failed to initialize the setup
DwinsHs_Error_OpenSession =Failed to open the FTP or HTTP session
DwinsHs_Error_CreateRequest =Failed to create an HTTP request handle
DwinsHs_Error_SendRequest =Failed to send request to the HTTP server
DwinsHs_Error_DeleteFile =The old file cannot be deleted
DwinsHs_Error_SaveFile =Failed to save data
DwinsHs_Error_Canceled =Download cancelled
DwinsHs_Error_ReadData =Failed to read data
DwinsHs_Status_HTTPError =HTTP error %d: %s
DwinsHs_Status_HTTP400 =Bad request
DwinsHs_Status_HTTP401 =Unauthorized
DwinsHs_Status_HTTP404 =Not found
DwinsHs_Status_HTTP407 =Proxy authentication required
DwinsHs_Status_HTTP500 =Internal error
DwinsHs_Status_HTTP502 =Bad gateway
DwinsHs_Status_HTTP503 =Service unavailable
DwinsHs_Status_HTTPxxx =Other error
DwinsHs_ReadyMemo_Download =Download files:
DwinsHs_ReadyMemo_Downloaded =(Downloaded)
For example, add the following messages to support the French and Chinese:
[CustomMessages]
; French custom messages for pre-defined downloading wizard page
fr.DwinsHs_PageCaption =Le téléchargement de fichiers supplémentaires
fr.DwinsHs_PageDescription =Se il vous plaît patienter pendant configuration \
télécharge des fichiers supplémentaires...
fr.DwinsHs_TotalProgress =Cours Total:
...
; Chinese custom messages for pre-defined downloading wizard page
chs.DwinsHs_PageCaption =下载附加文件
chs.DwinsHs_PageDescription =请稍等,正在下载必需的远程文件......
chs.DwinsHs_TotalProgress =总进度:
...
If the English messages are not required, or you want to define your own default custom messages in your script, you can define the DwinsHs_Disable_Custom_Messages macro before including the dwinshs.iss file to disabled the default custom messages in the dwinsHs.iss script. Optional, you can define your own default custom messages in your script. For example:
[CustomMessages]
; French custom messages for pre-defined downloading wizard page
fr.DwinsHs_PageCaption =Le téléchargement de fichiers supplémentaires
fr.DwinsHs_PageDescription =Se il vous plaît patienter pendant configuration \
télécharge des fichiers supplémentaires...
fr.DwinsHs_TotalProgress =Cours Total:
...
; Chinese custom messages for pre-defined downloading wizard page
chs.DwinsHs_PageCaption =下载附加文件
chs.DwinsHs_PageDescription =请稍等,正在下载必需的远程文件......
chs.DwinsHs_TotalProgress =总进度:
...
; Optional, define your own default custom messages for pre-defined downloading wizard page
; Here is in German
DwinsHs_PageCaption =Herunterladen zusätzlicher Dateien
DwinsHs_PageDescription =Bitte warten Sie, während Setup zusätzliche Dateien herunter ...
DwinsHs_TotalProgress =Gesamtfortschritt:
...
[Code]
#define DwinsHs_Use_Predefined_Downloading_WizardPage
...
#define DwinsHs_Disable_Custom_Messages
...
#include "dwinshs.iss"
...
Note, if you don't disable the default custom messages, please define your custom messages after the "[Code]" section which the dwinshs.iss file is included in it.
Compile your setup script and watch the download wizard page at work! If it doesn't work, please add a link to our website in your web page, then contact us and send your link page to us.
Copyright © 2001-2022, Han-soft Corporation. All rights reserved.