[Inno Setup] 退出安装程序的两种方式

1. 完全静默的退出

procedure ExitProcess(exitCode:integer);
  external '[email protected] 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;

猜你喜欢

转载自www.cnblogs.com/liujx2019/p/10528686.html
今日推荐