Inno Setup安装DirectX Visual C ++

时间:2014-09-26 13:53:40

标签: visual-c++ directx inno-setup

帮助安装directx visual c ++我在网上发现了这个脚本,但它不工作甚至不加以安装它安装的程序无论如何错误或帮我安装visual c ++ Directx的另一种方式谢谢

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

0 个答案:

没有答案