要將其包含在設置中,您可以將其安裝到{tmp}
,然後從那裏安裝[Run]
。
安裝這種要求正確的方法是在代碼中提取並呼籲它Exec()
在PrepareToInstall()
事件功能:
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。
此函數'NeedsDirectX()'從哪裏來? – 2012-12-18 14:05:41