作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经安装了我的程序。但是如果我尝试再次安装它,它会安装并且程序被替换。
我看到这个问题 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_MACHINE
和 HKEY_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;
IsUpgrade
函数来自
Can Inno Setup respond differently to a new install and an update?
关于inno-setup - Inno Setup - 如何在已安装应用程序时阻止安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42136282/
我是一名优秀的程序员,十分优秀!