If the pre-defined downloading wizard page is displayed, call the procedure to start downloading the remote files in the DwinsHs_DownloadsList download queue.
Please call the procedure in the CurPageChanged event function in order to start downloading automatically when the Setup wizard moves to the pre-defined downloading wizard page. If the event function isn't defined, please create it.
type
TBeforeDownload = function (): Boolean;
TAfterDownload = procedure (State: Integer);
procedure DwinsHs_CurPageChanged(CurPageID: Integer; BeforeDownload: TBeforeDownload;
AfterDownload: TAfterDownload);
Specifies the ID of current wizard page.
You can use the parameter to specify a 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. If the callback function is not required, please set it to nil.
See also the BeforeDownload callback function.
You can use the parameter to specify a 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. If the callback procedure is not required, please set it to nil.
See also the AfterDownload callback procedure.
The procedure should be used in the CurPageChanged event function.
procedure CurPageChanged(CurPageID: Integer);
begin
...
DwinsHs_CurPageChanged(CurPageID, nil, nil);
...
end;
If you want to use the DwinsHs_AppendRemoteFile, DwinsHs_RemoveAllRemoteFiles, and DwinsHs_ResetAllRemoteFiles procedures, or the DwinsHs_RemoveRemoteFile, DwinsHs_ResetRemoteFile, and DwinsHs_RemoteFilesCount functions, the BeforeDownload parameter must be set to a callback function. These procedures and functions should be used in the BeforeDownload callback function.
The DwinsHs_AppendMirrorFile function can be called in any time before calling the DwinsHs_CurPageChanged procedure, of course, you can use it in the BeforeDownload callback function.
For example:
function BeforeDownload(): Boolean;
begin
...
DwinsHs_AppendRemoteFile( ExpandConstant('{tmp}\abc.zip'), 'http://www.domain1.com/abc.zip',
'My_Setup', rmGet, FILESIZE_QUERY_SERVER );
...
DwinsHs_AppendMirrorFile( ExpandConstant('{tmp}\abc.zip'), 'http://www.domain2.com/abc.zip',
'My_Setup', rmGet );
...
Result := True;
end;
...
procedure CurPageChanged(CurPageID: Integer);
begin
...
DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, nil);
...
end;
In the BeforeDownload callback function, if you use the DwinsHs_AppendRemoteFile procedure to add a remote file , you need to intsall it using the Pascal script in the "[Code]" section by yourself. For example, move it to the application's folder. You can install it in the AfterDownload callback procedure, or the CurStepChanged event procedure.
For example:
function BeforeDownload(): Boolean;
begin
...
DwinsHs_AppendRemoteFile( ExpandConstant('{tmp}\abc.dll'), 'http://www.domain1.com/abc.dll',
'My_Setup', rmGet, 0 );
...
DwinsHs_AppendMirrorFile( ExpandConstant('{tmp}\abc.dll'), 'http://www.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;
The procedure is avaliable only when the DwinsHs_Use_Predefined_Downloading_WizardPage marco is defined.
Copyright © 2001-2022, Han-soft Corporation. All rights reserved.