I tested your code,
- Please move lines in
PrepareToInstall
method toBeforeDownload
method:
bVcRedist64BitNeeded := false;
if(IsWin64()) then
begin
bVcRedist64BitNeeded := IsVCRedist64BitNeeded();
end;
bVcRedist32BitNeeded := IsVCRedist32BitNeeded();
AddBecause the BeforeDownload
is called earlier than PrepareToInstall
method:.
- Then add method:
procedure CurPageChanged(CurPageID: Integer);
begin
DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
end;
then it works fine.
Also you can use the DwinsHs_Check
to add the download files:
[files]
Source: "{tmp}\a.exe"; DestDir: "{tmp}\vc_redist.x32.exe"; Flags: external; Check: IsVCRedist32BitNeeded() and DwinsHs_Check(ExpandConstant('{tmp}\a.exe'), 'https://aka.ms/vs/16/release/vc_redist.x86.exe', 'My_Setup', 'Get', 0, 0 );
Source: "{tmp}\b.exe"; DestDir: "{tmp}\vc_redist.x64.exe"; Flags: external; Check: IsWin64() and IsVCRedist64BitNeeded() and DwinsHs_Check(ExpandConstant('{tmp}\b.exe'), 'https://aka.ms/vs/16/release/vc_redist.x64.exe', 'My_Setup', 'Get', 0, 0 );
then remove the BeforeDownload
method.