[Inno Setup] 退出安裝程序的兩種方式


1. 完全靜默的退出

procedure ExitProcess(exitCode:integer);
  external 'ExitProcess@kernel32.dll stdcall';


...

[Code]
  if .... then begin
     ExitProcess(0);
  end;

 

2. 詢問用戶之后再退出

WizardForm.Close;

 

另外:

https://stackoverflow.com/questions/21737462/how-to-properly-close-out-of-inno-setup-wizard-without-prompt

未試驗過

var
  ForceClose: Boolean;

procedure Exterminate;
begin
  ForceClose:= True;
  WizardForm.Close;  
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
  Confirm:= not ForceClose;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
  ResultCode: Integer;
  X: Integer;
begin
  Log('NextButtonClick(' + IntToStr(CurPageID) + ') called');
  Result := True;
  case CurPageID of
    wpWelcome: begin
      if CheckForNewInstaller then begin
        Exterminate;
      end;
    end;
    ....
  end;
end;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM