Inno Setup:如何从regserver错误中删除中止? [英] Inno Setup: How to remove Abort from regserver error?

查看:88
本文介绍了Inno Setup:如何从regserver错误中删除中止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以显示消息框,当Files部分中的regserver标志发生错误时,仅显示重试忽略选项,而不是 Abort 选项.

I was wondering, if there is a way to make the message box displayed, when occurs an error from regserver flag in Files section, to show only Retry and Ignore option, not the Abort one.

我知道有一个标记noregerror.我不想不显示错误.我想展示它,但是只有两个选择.

I know there's a flag noregerror. I don't want to not show the error. I want to show it, but with only two options.

有时在尝试注册OCX/DLL时显示错误,当用户单击 Retry 时,它将在第二次运行.如果用户单击取消,安装程序将回滚所有内容,并从我的更新程序中删除文件.

Sometimes when the error is displayed while trying to register an OCX/DLL, when the user clicks in Retry, it works in the second time. If the user clicks in Cancel, the installer rollbacks everything, deleting the files from my update program.

谢谢.

推荐答案

无法自定义这些按钮.

但是您可以使用 RegisterServer 在代码中实现注册.然后,您可以按照自己喜欢的任何方式处理错误.实际上,您甚至可以自动重试注册,这似乎是您想做的.

But you can implement the registration in code using RegisterServer. Then you can handle errors any way you like. You can actually even retry the registration automatically, what you seem to actually want to do.

尽管实现重试/忽略消息框并不容易.以下代码使用简单的是/否.

Though it's not easy to implement Retry/Ignore message box. The below code uses simple Yes/No.

[Files]
Source: "MyDll.dll"; DestDir: "{app}"; AfterInstall: RegServer

[Code]

procedure RegServer;
var
  FileName: string;
  Message: string;
  Retry: Boolean;
begin
  repeat
    Retry := False;
    FileName := ExpandConstant(CurrentFilename);
    try
      { First argument indicates if DLL is 64-bit }
      RegisterServer(False, FileName, True);
    except
      Message :=
        FileName + #13#10#13#10 +
        FmtMessage(SetupMessage(msgErrorRegisterServer), [AddPeriod(GetExceptionMessage)]) +
          #13#10#13#10 +
        'Do you want to retry registration? ' +
        'Click Yes to try again or No to proceed anyway (not recommended).';
      Retry := (MsgBox(Message, mbError, MB_YESNO) = IDYES);
    end;
  until (not Retry);
end;

这篇关于Inno Setup:如何从regserver错误中删除中止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆