简体   繁体   中英

Skip installation in Inno Setup if other program is not installed

I have to find way how to skip installation if other program is not installed. I can detect registry of other program (basic script returns true/false), it is not problem. But I don't know how to skip installation.

In short: if one key in registry is not set, print message 'instal program xyz before this one' and finish installator.

This is very easy. Just add

[Code]

function IsApp2Installed: boolean;
begin
  result := RegKeyExists(HKEY_LOCAL_MACHINE,
    'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\app2.exe');
end;

function InitializeSetup: boolean;
begin
  result := IsApp2Installed;
  if not result then
    MsgBox('You need to install App2 before you install ThisApp. Install App2 and then run this installer again.', mbError, MB_OK);
end;

to your ISS file. InitializeSetup is a so-called event function that is executed when the installer starts (even before the wizard GUI is shown). If you return false , the installer will exit immediately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM