#define AppName "Example"
#define AppVersion "1.5"
; DirectX directory
#define DirectX "Redist\DirectX.exe"
; VC Redist directory
#define VC_Redist_x86 "Redist\vcredist_x86.exe"
#define VC_Redist_x64 "Redist\vcredist_x64.exe"
[Setup]
AppName={#AppName}
AppVersion={#AppVersion}
DefaultDirName={sd}\{#AppName}
[Code]
var
CheckBox: array[1..2] of TCheckBox;
procedure ClickBox(Sender: TObject);
begin
case Sender of
CheckBox[1]: begin
if CheckBox[1].Checked then CheckBox[1].Caption:=#$0020#$0052#$0075#$006E#$0020#$0044#$0069#$0072#$0065#$0063#$0074#$0058
else CheckBox[1].Caption:=#$0020#$0044#$006F#$0020#$006E#$006F#$0074#$0020#$0072#$0075#$006E#$0020#$0044#$0069#$0072#$0065#$0063#$0074#$0058
end;
CheckBox[2]: begin
if not IsWin64 then begin
if CheckBox[2].Checked then CheckBox[2].Caption:=#$0020#$0052#$0075#$006E#$0020#$0056#$0043#$0020#$0052#$0065#$0064#$0069#$0073#$0074#$0020#$0033#$0032#$002D#$0062#$0069#$0074
else CheckBox[2].Caption:=#$0020#$0044#$006F#$0020#$006E#$006F#$0074#$0020#$0072#$0075#$006E#$0020#$0056#$0043#$0020#$0052#$0065#$0064#$0069#$0073#$0074#$0020#$0033#$0032#$002D#$0062#$0069#$0074
end;
if IsWin64 then begin
if CheckBox[2].Checked then CheckBox[2].Caption:=#$0020#$0052#$0075#$006E#$0020#$0056#$0043#$0020#$0052#$0065#$0064#$0069#$0073#$0074#$0020#$0036#$0034#$002D#$0062#$0069#$0074
else CheckBox[2].Caption:=#$0020#$0044#$006F#$0020#$006E#$006F#$0074#$0020#$0072#$0075#$006E#$0020#$0056#$0043#$0020#$0052#$0065#$0064#$0069#$0073#$0074#$0020#$0036#$0034#$002D#$0062#$0069#$0074
end;
end;
end;
end;
procedure Initializewizard;
var
i: integer;
begin
for i:=1 to 2 do begin
CheckBox[i]:=TCheckBox.Create(WizardForm.FinishedPage);
with CheckBox[i] do
begin
Parent:=WizardForm.FinishedPage;
Top:=(WizardForm.YesRadio.Top-50)+(i*WizardForm.YesRadio.Height+5);
Left:=WizardForm.YesRadio.Left;
Width:=WizardForm.YesRadio.Width;
OnClick:=@ClickBox;
Checked:=True;
end;
end;
end;
procedure DeinitializeSetup;
var
ResultCode: Integer;
begin
if CheckBox[1].Checked then Exec(ExpandConstant('{src}\{#DirectX}'),'','', SW_SHOWNORMAL, ewNoWait, ResultCode);
if CheckBox[2].Checked and not IsWin64 then Exec(ExpandConstant('{src}\{#VC_Redist_x86}'),'','', SW_SHOWNORMAL, ewNoWait, ResultCode);
if CheckBox[2].Checked and IsWin64 then Exec(ExpandConstant('{src}\{#VC_Redist_x64}'),'','', SW_SHOWNORMAL, ewNoWait, ResultCode);
WizardForm.Free;
end;