Skip to main content
added 168 characters in body; added 16 characters in body
Source Link

I tested your code,

  1. Please move lines in PrepareToInstall method to BeforeDownload method:
  bVcRedist64BitNeeded := false;
  if(IsWin64()) then
  begin
    bVcRedist64BitNeeded := IsVCRedist64BitNeeded();
  end;
  bVcRedist32BitNeeded := IsVCRedist32BitNeeded();

AddBecause the BeforeDownload is called earlier than PrepareToInstall method:.

  1. 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.

I tested your code,

Add method:

procedure CurPageChanged(CurPageID: Integer);
begin
  DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
end;

then it works fine.

Also you can use:

[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.

I tested your code,

  1. Please move lines in PrepareToInstall method to BeforeDownload method:
  bVcRedist64BitNeeded := false;
  if(IsWin64()) then
  begin
    bVcRedist64BitNeeded := IsVCRedist64BitNeeded();
  end;
  bVcRedist32BitNeeded := IsVCRedist32BitNeeded();

Because the BeforeDownload is called earlier than PrepareToInstall method.

  1. Then add method:
    procedure CurPageChanged(CurPageID: Integer);
    begin
      DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
    end;

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.

added 168 characters in body
Source Link

I tested your code,

Add method:

procedure CurPageChanged(CurPageID: Integer);
begin
  DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
end;

then it works fine.

Also you can use:

[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 );

thethen remove the BeforeDownload method.

I tested your code, it works fine.

Also you can use:

[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 );

the remove the BeforeDownload method.

I tested your code,

Add method:

procedure CurPageChanged(CurPageID: Integer);
begin
  DwinsHs_CurPageChanged(CurPageID, @BeforeDownload, @AfterDownload);
end;

then it works fine.

Also you can use:

[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.

Source Link

I tested your code, it works fine.

Also you can use:

[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 );

the remove the BeforeDownload method.