1

我想做的事:

如果用户在 wpWelcome 上单击“下一步”并且如果在计算机上找到旧版本的应用程序,那么我会提示一个 msgbox。

如果用户在 msgbox 上单击“取消”,那么我想在没有提示的情况下中止安装并关闭向导,就像带有 TSetupStep 的 abort(),但 WizardForm.Close 会提示另一个 msgbox 确认取消。有什么办法可以抑制这种情况吗?

我当前的代码如下:

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;
4

0 回答 0