2

我正在尝试覆盖 wpFinished 页面上的 Next/Cancel 按钮 - NextButton 应该显示下载的文件并退出安装程序 - 它工作正常,但 CancelButton 什么也不做 - 它应该使用标准确认关闭安装程序。我想知道标准的 inno 事件是否有可能,或者我需要编写自己的代码来退出应用程序并显示确认?

function NextButtonClick(CurPage: Integer): Boolean;
begin
  if CurPage = wpFinished then begin
    ShowDownloadedFile();
  end;
  Result := True;
end;


procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpFinished then begin
    WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);  
    WizardForm.CancelButton.Caption := SetupMessage(msgButtonFinish);  
    WizardForm.CancelButton.Visible := True;  
  end;
end;
4

2 回答 2

2

在这里,但不要在家里做这个孩子:-)

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Code]
procedure ExitProcess(uExitCode: UINT);
  external 'ExitProcess@kernel32.dll stdcall';

function NextButtonClick(CurPage: Integer): Boolean;
begin
  Result := True;
  // if the fake Finish button was clicked...
  if CurPage = wpFinished then
    MsgBox('Welcome to the next installation!', mbInformation, MB_OK);
end;

procedure CancelButtonClickFinishedPage(Sender: TObject);
begin
  // display the "Exit Setup ?" message box and if the user selects "Yes",
  // then exit the process; it is currently the only way how to exit setup
  // process manually
  if ExitSetupMsgBox then
    ExitProcess(0);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpFinished then
  begin
    WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);  
    WizardForm.CancelButton.Caption := SetupMessage(msgButtonFinish);  
    WizardForm.CancelButton.Visible := True;
    // bind your own OnClick event for the Cancel button; the original one
    // is already disconnected at this stage
    WizardForm.CancelButton.OnClick := @CancelButtonClickFinishedPage;
  end;
end;
于 2013-10-25T08:51:46.967 回答
1

您尝试做的正确替代方法是包含[Run]如下条目:

[Run]
Filename: {app}\yourfile.exe; Description: Run my application; Flags: postinstall nowait

这将在wpFinished页面上显示一个复选框,让他们选择是否运行应用程序。

于 2013-10-27T18:37:27.150 回答