使用进程退出代码在[运行]中显示特定文件的错误消息 [英] Using Process Exit code to show error message for a specific File in [Run]

查看:70
本文介绍了使用进程退出代码在[运行]中显示特定文件的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果[RUN]进程之一未返回进程代码0,请使用innosetup并要显示错误/msgbox.我将其用于授权过程,如果授权不成功,我想通知用户. /p>

我有以下内容:

Filename: "{pf32}\Common Files\Authorization.exe"; Parameters: " "{code:GetAuthorizationFilePath}" /s"; WorkingDir: "{tmp}"; Flags: skipifdoesntexist hidewizard; StatusMsg: "Authorizing License"; 

还给我:

Process exit code:0

0当然是成功的,但是如果它不是0,我想通知用户.

有办法吗?

感谢和问候, Kev84

解决方案

我认为[Run]部分无法实现此目的.您可以做的是:

  • 使用Pascal脚本执行此任务
  • 或显示已执行的应用程序Authorization.exe中的模式错误消息,并仅在用户确认错误消息后终止该错误消息(然后安装将继续,例如,执行[Run]部分中的其他文件)

这是Pascal脚本的代码示例;您还可以检查以下代码的 commented version :

 [Code]

function NextButtonClick(CurPageID: Integer): Boolean;
var
  ResultCode: Integer;
begin
  Result := True;

  if CurPageID = wpWelcome then
  begin
    Result := False;
    if Exec(ExpandConstant('{pf32}\Common Files\Authorization.exe'), '', '', 
      SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      if ResultCode = 0 then    
        Result := True
      else
        MsgBox('The authorization failed!', mbCriticalError, MB_OK);
    end;
  end;
end;
 

Using innosetup and want to show error/msgbox if one of the [RUN] process does not return process code 0. I'm using it for authorization process, if authorization is not successful, i want to notify the user.

I have following:

Filename: "{pf32}\Common Files\Authorization.exe"; Parameters: " "{code:GetAuthorizationFilePath}" /s"; WorkingDir: "{tmp}"; Flags: skipifdoesntexist hidewizard; StatusMsg: "Authorizing License"; 

Returns me:

Process exit code:0

0 of course is successful, but if its not 0 i want to notify the user.

Is there a way to do that?

Thanks and Regards, Kev84

解决方案

I think there's no way to accomplish this from the [Run] section. What you can do is:

  • use the Pascal Script for this task
  • or display the modal error message from your executed application Authorization.exe and terminate it only after the user confirms the error message (setup will then continue e.g. with the execution of the other files in the [Run] section)

Here is the code sample of the Pascal Script; you can check also the commented version of this code:

[Code]

function NextButtonClick(CurPageID: Integer): Boolean;
var
  ResultCode: Integer;
begin
  Result := True;

  if CurPageID = wpWelcome then
  begin
    Result := False;
    if Exec(ExpandConstant('{pf32}\Common Files\Authorization.exe'), '', '', 
      SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      if ResultCode = 0 then    
        Result := True
      else
        MsgBox('The authorization failed!', mbCriticalError, MB_OK);
    end;
  end;
end;

这篇关于使用进程退出代码在[运行]中显示特定文件的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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