installation - 如何从 Inno-setup 安装 DirectX 可再发行组件?

标签 installation directx inno-setup

我在 Inno-Setup 网站上没有找到任何关于 DirectX 安装的提示。那么,有没有示例安装脚本?我知道我必须向 [Run] 部分添加如下内容:

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

但是如何将它包含到安装文件(临时文件夹?)中,如何提取它,等等?

最佳答案

要将它包含在安装程序中,您可以将它安装到 {tmp},然后从那里[运行]

安装此类要求的正确方法是提取代码并在 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;

ISXKB 有一个 article on how to detect the versions installed .

关于installation - 如何从 Inno-setup 安装 DirectX 可再发行组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8723836/

相关文章:

directx - 如何使用 Direct3D 使灯光在世界中保持固定

c# - DirectX 9、10 Hook 以在全屏游戏上覆盖内容

c++ - HLSL 中的镜面反射

inno-setup - 在 Inno Setup 安装期间重命名/替换快捷方式

inno-setup - Inno Setup Exec 不等待 InstallShield 卸载完成

c# - MSI卸载不删除所有文件夹

python - Conda 软件包安装 [Errno 13] 安装 conda-forge::protobuf-3.8.0 时权限被拒绝

c++ - 在 Linux Mint 中使用 Code::Blocks 设置 C++

mysql - 在端口 3306 上运行的另一个 mysqld 服务器错误

inno-setup - Inno Setup 安装的默认值