I've installed my program. But if I try to install it again, it does and the program is replaced.
I saw this question Inno Setup - How to display notifying message while installing if application is already installed on the machine?
Can I create a certain registry entry so I can check it and prevent a new installation? In this question there is some related information: Skip installation in Inno Setup if other program is not installed.
/SUPPRESSMSGBOXES. Instructs Setup to suppress message boxes. Only has an effect when combined with '/SILENT' and '/VERYSILENT'. The default response in situations where there is normally a choice for the user during installation is: •
Create MSI with Inno Setup. The MSI Wrapper was produced to create MSI packages from executable files built with Inno Setup. It puts the setup.exe inside an MSI file and runs it with the specified command line switches when the MSI package is installed.
To prevent this behavior, you can suppress the log file by specifying /LogFile= (with no filename argument) after Installutil.exe on the command line.
Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.
You do not need to create any registry key. The installer already creates a registry key for the uninstaller. You can just check that. It's the same key, that the answer to question, you refer to, uses. But you do not need to do the check for version. Just check an existence. Also you should check both the HKEY_LOCAL_MACHINE
and the 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;
Or just reuse IsUpgrade
function from Can Inno Setup respond differently to a new install and an update?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With