0

Help to install directx visual c ++ I found this script on the net but it is not working even leaving unchecked not to install the program it installs anyway where is the error or help me with another way to install visual c++ Directx thanks

    [Setup]
AppName=My Program
AppVersion=1.5
;AppVerName=My Program 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
;OutputDir=.


[Languages]
Name: eng; MessagesFile: compiler:Default.isl


[CustomMessages]
eng.DirectX=???? ?????????? DirectX...   ??????????, ?????????.
eng.Redist=???? ????????? VisualC++ Redist...   ??????????, ?????????.
eng.PhysX=???? ????????? Nvidia PhysX...   ??????????, ?????????.
eng.Oalinst=???? ????????? Open AL...   ??????????, ?????????.
eng.Adobe=???? ????????? Adobe Reader...   ??????????, ?????????.


[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Icons]
Name: {group}\My Program; Filename: {app}\MyProg.exe
Name: {group}\{cm:UninstallProgram,My Program}; Filename: {uninstallexe}
Name: {commondesktop}\My Program; Filename: {app}\MyProg.exe; Tasks: desktopicon

[Run]
Filename: {src}\DirectX\DXSETUP.exe; WorkingDir: {src}\DirectX\; Parameters: /silent; Flags: waituntilterminated; Check: DirectXCheck; StatusMsg: ???? ?????????? DirectX...   ??????????, ?????????.
Filename: {src}\Redist\VisualC++\vcredist_x86.exe; WorkingDir: {src}\Redist\VisualC++\; Parameters: /q; Flags: waituntilterminated; Check: RedistCheck and not IsWin64; StatusMsg: ???? ????????? VisualC++ Redist...   ??????????, ?????????.
Filename: {src}\Redist\VisualC++\vcredist_x64.exe; WorkingDir: {src}\Redist\VisualC++\; Parameters: /q; Flags: waituntilterminated; Check: RedistCheck and IsWin64; StatusMsg: ???? ????????? VisualC++ Redist...   ??????????, ?????????.
Filename: {src}\Open AL\oalinst.exe; WorkingDir: {src}\Open AL\; Parameters: /silent; Flags: waituntilterminated; Check: OalinstCheck; StatusMsg: ???? ????????? Open AL...   ??????????, ?????????.
Filename: {src}\Adobe Reader\Adobereader_9.40.exe; WorkingDir: {src}\Adobe Reader\; Flags: waituntilterminated; Check: AdobeCheck; StatusMsg: ???? ????????? Adobe Reader...   ??????????, ?????????.
Filename: {src}\PhysX\PhysX_9.09.0814_SystemSoftware.exe; WorkingDir: {src}\PhysX\; Parameters: /quiet; StatusMsg: ???? ????????? Nvidia PhysX; Flags: waituntilterminated; Check: PhysXCheck

[Code]
var
  // ??? ????????
  DirectX: TNewCheckBox;
  Redist: TNewCheckBox;
  Adobe: TNewCheckBox;
  Oalinst: TNewCheckBox;
  PhysX: TNewCheckBox;
  // ??? ????????

  // ??? ???????? ?????????
  // DirectX
function DirectXCheck: Boolean;
begin
  Result:=DirectX.Checked;
end;

procedure DirectXOnClick(Sender: TObject);
begin
  if DirectX.Checked = False then
    DirectX.Checked:= True else
  DirectX.Checked:= False;
end;

  // Redist
function RedistCheck: Boolean;
begin
  Result:=Redist.Checked;
end;

procedure RedistOnClick(Sender: TObject);
begin
  if Redist.Checked = False then
    Redist.Checked:= True else
  Redist.Checked:= False;
end;

  // Adobe
function AdobeCheck: Boolean;
begin
  Result:=Adobe.Checked;
end;

procedure AdobeOnClick(Sender: TObject);
begin
  if Adobe.Checked = False then
    Adobe.Checked:= True else
  Adobe.Checked:= False;
end;

  // Oalinst
function OalinstCheck: Boolean;
begin
  Result:=Oalinst.Checked;
end;

procedure OalinstOnClick(Sender: TObject);
begin
  if Oalinst.Checked = False then
    Oalinst.Checked:= True else
  Oalinst.Checked:= False;
end;

  // PhysX
function PhysXCheck: Boolean;
begin
  Result:=PhysX.Checked;
end;

procedure PhysXOnClick(Sender: TObject);
begin
  if PhysX.Checked = False then
    PhysX.Checked:= True else
  PhysX.Checked:= False;
end;

procedure InitializeWizard();
begin
  { DirectX }
  DirectX := TNewCheckBox.Create(WizardForm);
  with DirectX do
  begin
    Name := 'DirectX';
    Parent := WizardForm.SelectTasksPage; //Usar WizardForm;
    Left := ScaleX(10);
    Top := ScaleY(90);
    Width := ScaleX(150);
    Height := ScaleY(17);
    Caption := 'Install: DirectX';
  end;

  { Redist }
  Redist := TNewCheckBox.Create(WizardForm);
  with Redist do
  begin
    Name := 'Redist';
    Parent := WizardForm.SelectTasksPage; //Usar WizardForm;
    Left := ScaleX(10);
    Top := ScaleY(115);
    Width := ScaleX(170);
    Height := ScaleY(17);
    Caption := 'Install: VisualC++ Redist';
  end;

  { Adobe }
  Adobe := TNewCheckBox.Create(WizardForm);
  with Adobe do
  begin
    Name := 'Adobe';
    Parent := WizardForm.SelectTasksPage; //Usar WizardForm;
    Left := ScaleX(10);
    Top := ScaleY(140);
    Width := ScaleX(190);
    Height := ScaleY(17);
    Caption := 'Install: Adobe Reader';
  end;

  { Oalinst }
  Oalinst := TNewCheckBox.Create(WizardForm);
  with Oalinst do
  begin
    Name := 'Oalinst';
    Parent := WizardForm.SelectTasksPage; //Usar WizardForm;
    Left := ScaleX(10);
    Top := ScaleY(165);
    Width := ScaleX(150);
    Height := ScaleY(17);
    Caption := 'Install: Open AL';
  end;

  { PhysX }
  PhysX := TNewCheckBox.Create(WizardForm);
  with PhysX do
  begin
    Name := 'NewCheckBox1';
    Parent := WizardForm.SelectTasksPage;  //Usar WizardForm;
    Left := ScaleX(10);
    Top := ScaleY(190);
    Width := ScaleX(150);
    Height := ScaleY(17);
    Caption := 'Install: PhysX';
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var res: integer;
begin
if CurStep = ssPostInstall then begin
    begin
    If PhysX.Checked then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:PhysX}');
    Exec(ExpandConstant('{src}\Redist\PhysX_9.09.0428_System Software.exe'), '/quiet', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, Res);
    If DirectX.Checked then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:DirectX}');
    Exec(ExpandConstant('{src}\DirectX\DXSETUP.exe'), '/silent', ExpandConstant('{src}\DirectX'), SW_SHOW, ewWaitUntilTerminated, Res);
    If Redist.Checked then
    if isWin64 then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:Redist}');
    Exec(ExpandConstant('{src}\Redist\vcredist_x64.exe'), '/Q', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, Res);
    if not IsWin64 then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:Redist}');
    Exec(ExpandConstant('{src}\Redist\vcredist_x86.exe'), '/Q', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, Res);
    If Oalinst.Checked then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:Oalinst}');
    Exec(ExpandConstant('{src}\Redist\oalinst.exe'), '/quiet', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, Res);
    If Adobe.Checked then
    WizardForm.FileNameLabel.Caption:=ExpandConstant('{cm:Adobe}');
    Exec(ExpandConstant('{src}\Redist\Adobereader_9.40.exe'),'', ExpandConstant('{src}\Redist'), SW_SHOW, ewWaitUntilTerminated, Res);
end;
end;
end;
Miki
  • 2,493
  • 2
  • 27
  • 39
Marcio
  • 183
  • 3
  • 12
  • The `{src}` constant points to a directory where the setup binary is stored (for example if you run your Inno Setup binary let's say from `C:\Setup.exe`, then you are expecting to have e.g. `vcredist_x64` stored in `C:\Redist\vcredist_x64.exe`). Do you have all those installers there ? Btw. if you are calling `Exec`, it returns a boolean value if the execution succeeded and if it fails, you should check the exit code which you are storing into the `res` variable in your code. I bet you're getting exit code 2. – TLama Sep 26 '14 at 14:05
  • Or to be more precise, if you were running your setup binary from `C:\Setup.exe`, then you are expecting to have `vcredist_x64` stored in `C:\Redist\VisualC++\vcredist_x64.exe` in your `[Run]` section and in `C:\Redist\vcredist_x64.exe` in your `[Code]` section. – TLama Sep 26 '14 at 14:10
  • Thank Tlama 'm not even understand with visual example ++ c (cleared not to install) it installs anyway – Marcio Sep 26 '14 at 14:13
  • You are trying to do the same thing from two places, once from `[Run]` section, next time from `[Code]` (each time from a different path though). But none of them is appropriate for installing prerequisites. You should prefer using `PrepareToInstall` event for that. Also, you have no checks whether those prerequisites are installed on the user's system already (that's what I would personally expect from an installer). And finally, you don't need to create tasks check boxes; that's what the `[Tasks]` entries do for you. – TLama Sep 26 '14 at 14:27
  • Tlama you could post a sample script to install the visual c ++ no need to check if the User already have it installed. – Marcio Sep 26 '14 at 14:45
  • Which version of C++ redist ? I [`did it`](http://stackoverflow.com/a/11172939/960757) for a few versions (but you should use `PrepareToInstall` event rather than `[Run]` section as I did there). – TLama Sep 26 '14 at 14:50
  • BTW, be sure to read [Not So DirectSetup](http://blogs.msdn.com/b/chuckw/archive/2010/09/08/not-so-direct-setup.aspx) so you understand if you even need to use DXSETUP. If you do, be sure to [trim down to the minimal set of files your app needs](http://msdn.microsoft.com/en-us/library/ee416805.aspx#small_installation_packages) and use the [latest version](http://blogs.msdn.com/b/chuckw/archive/2011/04/19/dxsetup-update.aspx). – Chuck Walbourn Sep 27 '14 at 18:05
  • TLama version of Microsoft Visual C ++ 2008 and 2010 – Marcio Sep 29 '14 at 13:30

0 Answers0