gpt4 book ai didi

inno-setup - Inno Setup - 如何在已安装应用程序时阻止安装?

转载 作者:行者123 更新时间:2023-12-04 12:14:31 29 4
gpt4 key购买 nike

我已经安装了我的程序。但是如果我尝试再次安装它,它会安装并且程序被替换。
我看到这个问题 Inno Setup - How to display notifying message while installing if application is already installed on the machine?
我可以创建一个特定的注册表项,以便我可以检查它并阻止新安装吗?在这个问题中有一些相关信息:Skip installation in Inno Setup if other program is not installed .

最佳答案

您不需要创建任何注册表项。安装程序已经为卸载程序创建了一个注册表项。你可以检查一下。您所指的问题的答案使用的是同一个键。但是您不需要检查版本。只是检查一个存在。您还应该检查 HKEY_LOCAL_MACHINEHKEY_CURRENT_USER :

#define AppId "myapp"

[Setup]
AppId={#AppId}

[Code]

function InitializeSetup(): Boolean;
begin
Result := True;
if RegKeyExists(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppId}_is1') or
RegKeyExists(HKEY_CURRENT_USER,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppId}_is1') then
begin
MsgBox('The application is installed already.', mbInformation, MB_OK);
Result := False;
end;
end;
The application is installed already

或者只是重复使用 IsUpgrade函数来自 Can Inno Setup respond differently to a new install and an update?

关于inno-setup - Inno Setup - 如何在已安装应用程序时阻止安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42136282/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com