2012-01-04 13 views
2

Inno-SetupのWebサイトでDirectXのインストールに関するヒントが見つかりませんでした。では、サンプルインストールスクリプトはありますか?Inno-setupからDirectX redistributableをインストールするには?

Filename: "{src}\DirectX\DXSETUP.exe"; WorkingDir: "{src}\DirectX"; Parameters: "/silent"; Check: DirectX; Flags: waituntilterminated; BeforeInstall: DirectXProgress; 

しかし、どのようにセットアップファイルにそれを含めるために、どのようにそれを抽出し、電気ショック療法:私はこのような[ファイル名を指定して実行] sction何かに追加する必要があることを知っている(tempフォルダ?)?

答えて

6

セットアップに含めるには、{tmp}にインストールしてから[Run]にインストールします。

function PrepareToInstall(var NeedsRestart: Boolean): String; 
var 
    InstallerResult: integer; 
begin 
    //Check if .Net is available already 
    if NeedsDirectX() then begin 
    ExtractTemporaryFile('DXSETUP.exe'); 
    if Exec(ExpandConstant('{tmp}\DXSETUP.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, InstallerResult) then begin 
     case InstallerResult of 
     0: begin 
      //It installed successfully (Or already was), we can continue 
     end; 
     else begin 
      //Some other error 
      result := 'DirectX installation failed. Exit code ' + IntToStr(InstallerResult); 
     end; 
     end; 
    end else begin 
     result := 'DirectX installation failed. ' + SysErrorMessage(InstallerResult); 
    end; 
    end; 
end; 

ISXKBがarticle on how to detect the versions installedがあります

要件のこの種をインストールするための正しい方法は、コードに抽出しPrepareToInstall()イベント関数でそれにExec()を呼び出すことです。

+0

この関数 'NeedsDirectX() 'はどこから来たのですか? –

関連する問題