1

What I want to do:

If the user clicks "Next" on wpWelcome and if an old version of the app is found on the computer, then I prompt a msgbox.

If the user clicks "cancel" on msgbox then I want to abort installation and close wizard without prompt, just like abort() with TSetupStep, but WizardForm.Close prompts another msgbox to confirm cancelation. Is there any way to suppress this?

My current code below:

function NextButtonClick(CurPage: Integer): Boolean;
begin
  if (CurPage=wpWelcome) then
  begin
    if (AppAlreadyInstalled()) then
    begin
      if MsgBox('Another installation of {#MyAppName} has been detected. 
         Proceeding with "OK" will uninstall the existing program first. 
         Press "cancel" to abort and exit installer.', 
         mbConfirmation, MB_OKCANCEL or MB_DEFBUTTON2) = IDOK  then
      begin
        UnInstallOldVersion();
        Result:= True;
      end
      else
      begin
        Result:= False; 
        WizardForm.Close;
      end;
    end; 
  end;
end;
Wuyoung Ch
  • 43
  • 5

0 Answers0