You can use the AfterDownload parameter to specify a callback procedure when you make the DwinsHs_CurPageChanged procedure call. The callback procedure will be executed when the download operation completes. Then the DwinsHs_CurPageChanged procedure returns.
type
TAfterDownload = procedure (State: Integer);
Contains the state code in integer. It can be one of the following values:
The callback procedure will not be executed if the BeforeDownlaod callback function returns false, and the DwinsHs_CurPageChanged procedure will return immediately.
You can use the callback procedure to run, move or decompress files downloaded just now.
For example:
function BeforeDownload(): Boolean;
begin
...
DwinsHs_AppendRemoteFile(ExpandConstant('{tmp}\abc.dll'), 'http://www.domain1.com/abc.dll',
'My_Setup', rmGet, FILESIZE_QUERY_SERVER);
...
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;
Copyright © 2001-2022, Han-soft Corporation. All rights reserved.