Inno Setup: Disable components page on upgrade

前端 未结 3 598
盖世英雄少女心
盖世英雄少女心 2020-12-06 13:21

Is there a way to disable the Components Page for Upgrades? I would like to enable upgrades of my software but I don\'t want to allow the users to change the selection of co

3条回答
  •  情话喂你
    2020-12-06 13:56

    The IsUpgrade function mentioned in TLama's answer has a bug. If AppId starts with a "{" which must be doubled, this isn't resolved and they registry key will not be found. Here's a corrected function that works for me:

    function IsUpgrade: Boolean;
    var
        Value: string;
        UninstallKey: string;
    begin
        UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
            ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
        Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
            RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
    end;
    

    Leave the separate const away for this function, it won't work with that extra function call.

    Apart from that, 64-bit systems don't seem to cause any issues. If InnoSetup runs in 32-bit mode, the registry virtualisation is in effect and redirects you to the correct key already.

提交回复
热议问题