[英]How to install DirectX redistributable from Inno-setup?
I didn't find any tip about DirectX installation at Inno-Setup web site. 在Inno-Setup网站上找不到关于DirectX安装的任何提示。 So, is there any sample installation script?
那么,有任何示例安装脚本吗? I know that I have to add to [Run] sction something like this:
我知道我必须在[Run]部分添加如下内容:
Filename: "{src}\DirectX\DXSETUP.exe"; WorkingDir: "{src}\DirectX"; Parameters: "/silent"; Check: DirectX; Flags: waituntilterminated; BeforeInstall: DirectXProgress;
But how to include it into setup file (temp folder?), how to extract it, ect? 但是如何将其包含在安装文件(临时文件夹?)中,如何将其提取等?
To include it in the setup, you can install it to {tmp}
and then [Run]
it from there. 要将其包括在设置中,您可以将其安装到
{tmp}
,然后从那里[Run]
。
The correct way to install this sort of requirement is to extract in code and call Exec()
on it in the PrepareToInstall()
event function: 安装这种要求的正确方法是提取代码并在
PrepareToInstall()
事件函数中对其调用Exec()
:
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;
The ISXKB has an article on how to detect the versions installed . ISXKB上有一篇有关如何检测已安装版本的文章 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.