I am trying to create an installer that is a Demo installer that if it detects the file close.txt
in the programs folder then it closes the wizard or aborts ins
Test for the file existence in InitializeSetup event function and return False
, if it exists.
[Setup]
DefaultDirName={autopf}\My Program
[Code]
function WasMyProgramEverInstalled: Boolean;
begin
Result := FileExists('{#SetupSetting("DefaultDirName")}\close.txt');
end;
function InitializeSetup: Boolean;
begin
Result := True;
if WasMyProgramEverInstalled then
begin
MsgBox('Some message', mbError, MB_OK); { Optionally }
Result := False;
end;
end;
Note that if the installer allow customizing an installation path, you won't know it, when re-running the installation after uninstallation. So this won't work.