inno-setup - 创新设置 : detect installation based on product code

标签 inno-setup

我想实现类似于 Inno setup - skip installation if other program is not installed 的东西

但我确实有 msiexec 产品代码(如 D3AA40C4-9BFB-4640-88CE-EDC93A3703CC)。那么如何根据这个产品代码检测是否安装了其他程序呢?

最佳答案

MsiQueryProductState为此功能。这是它的导入,带有用于您的任务的辅助函数:

[Code]
#IFDEF UNICODE
  #DEFINE AW "W"
#ELSE
  #DEFINE AW "A"
#ENDIF
type
  INSTALLSTATE = Longint;
const
  INSTALLSTATE_DEFAULT = 5;

function MsiQueryProductState(szProduct: string): INSTALLSTATE; 
  external 'MsiQueryProductState{#AW}@msi.dll stdcall';

function IsProductInstalled(const ProductID: string): Boolean;
begin
  Result := MsiQueryProductState(ProductID) = INSTALLSTATE_DEFAULT;
end;

及其可能的用法:

if IsProductInstalled('{D3AA40C4-9BFB-4640-88CE-EDC93A3703CC}') then
  MsgBox('The product is installed.', mbInformation, MB_OK);

关于inno-setup - 创新设置 : detect installation based on product code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30892692/

相关文章:

inno-setup - Inno Setup 会记住下次安装中的自定义复选框状态

inno-setup - 如何禁用默认目录向导页面上的 "browse"按钮

inno-setup - Inno 使用 GDI+ 设置动画 GIF?

inno-setup - 安装到 USB 驱动器根目录时出现 Inno Setup 错误 : "You must enter a full path with drive letter"

inno-setup - 由 Inno Setup 和 SPAWNWND 构建的安装程序,UAC 窗口上的 NOTIFYWND 参数

inno-setup - 下载带有 IDP : Download plugin for Inno Setup, 的 .zip 文件并解压它们

return-value - 从命令行应用程序将字符串值传递给 Inno Setup

inno-setup - Inno Setup,[Run] 中的空格和双引号

installation - 将字符串转换为字节数组将不起作用

window - Inno Setup - 签名失败并显示 "Sign Tool failed with exit code 0x1"