本文介绍了如何从Inno-setup安装DirectX可再发行组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Inno-Setup网站上找不到关于DirectX安装的任何提示。那么,有任何示例安装脚本吗?我知道我必须在[运行]部分添加以下内容:
I didn't find any tip about DirectX installation at Inno-Setup web site. So, is there any sample installation script? I know that I have to add to [Run] sction something like this:
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?
推荐答案
要将其包含在设置中,您可以将其安装到 {tmp}
,然后从那里。
To include it in the setup, you can install it to {tmp}
and then [Run]
it from there.
安装这种要求的正确方法是提取代码并在 PrepareToInstall()
事件函数中对其调用 Exec()
:
The correct way to install this sort of requirement is to extract in code and call Exec()
on it in the PrepareToInstall()
event function:
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的。
这篇关于如何从Inno-setup安装DirectX可再发行组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!