DwinsHs_CurPageChanged procedure

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.

Declaration:

type
  TBeforeDownload = function (): Boolean;
  TAfterDownload = procedure (State: Integer);
procedure DwinsHs_CurPageChanged(CurPageID: Integer; BeforeDownload: TBeforeDownload;
  AfterDownload: TAfterDownload);

Parameters:

Example:

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;

Note:

The procedure is avaliable only when the DwinsHs_Use_Predefined_Downloading_WizardPage marco is defined.