I would like the [InstallDelete]
section to call a custom function that will check if an older version is installed (in which case certain files need to be deleted prior installation of the new version).
Extract from my Inno Setup script. First the function that returns True if an older version is installed.
[Code]
function deleteExistingHhd: Boolean;
var Version: String;
begin
MsgBox('Checking for key:'+'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+ExpandConstant('AppId')+'_is1', mbInformation, MB_OK);
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+ExpandConstant('AppId')+'_is1', 'DisplayVersion') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+ExpandConstant('AppId')+'_is1', 'DisplayVersion', Version);
MsgBox('Existing version:'+Version+' New version:'+ExpandConstant('AppVersion'), mbInformation, MB_OK);
if (Version < '1.013') then
begin
Result := True;
end
else
begin
Result := False;
end
end
else
begin
Result := False;
end
end;
Then the section that should call this function:
[InstallDelete]
Type: files; Name: {userappdata}\xxx\*.hhd; Check:deleteExistingHhd;
Unfortunately the generated setup seems to never call the custom function (when installing my program with this setup I never get the MsgBox located in the custom function and the files are not deleted).
Is it possible that my function has some errors that are not indicated when Inno Setup compiles? If so, where could I find them?
Any help / hint would be very much appreciated; thanks!