简体   繁体   English

捕获其他安装程序文件的事件,如Inno Setup中的Notepad ++安装程序

[英]Capture events of other installer file like Notepad++ setup in Inno Setup

I want to execute an executable file ( npp.exe ) before installation begins in Inno Setup. 我想在Inno Setup中安装之前执行可执行文件( npp.exe )。 But I am not able to capture the nextButton event of the npp.exe executable. 但是我无法捕获npp.exe可执行文件的nextButton事件。 Is there any way to do it? 有什么办法吗? I tried with following code: 我尝试使用以下代码:

function initializeSetup(): boolean;
var
  ResultCode: integer;
  path: string;
begin
   if Exec(('C:\Users\Paxcel\Downloads\npp.exe'), '', '', SW_SHOW,
       ewWaitUntilTerminated, ResultCode) then
    begin
       //result code = 0 for successful installation
       if (ResultCode = 0)then
          begin
              Result := True;
          end
          else
          begin
              Result := False;
          end;
    // handle success if necessary; ResultCode contains the exit code
     end
     else begin
        MsgBox(SysErrorMessage(ResultCode),mbError,MB_OK);
        Result := False;// handle failure if necessary; ResultCode contains the error code
     end;
   end;

In this code, I want to capture the next button of Notepad++ setup. 在这段代码中,我想捕获Notepad ++设置的下一个按钮。 Default functions like NextButtonClick cannot be used. 无法使用NextButtonClick等默认函数。

The Notepad++ uses NSIS installer. Notepad ++使用NSIS安装程序。

If you want to run (any) NSIS installer silently, use /S command-line switch. 如果要以静默方式运行(任何)NSIS安装程序,请使用/S命令行开关。

See NSIS Installer usage . 请参阅NSIS安装程序用法


Btw, I assume that the path C:\\Users\\Paxcel\\Downloads is just for testing. 顺便说一下,我假设路径C:\\Users\\Paxcel\\Downloads仅用于测试。 In a real installer, you have to embed the dependency to your installer and extract it to a temporary directory to execute it. 在真正的安装程序中,您必须将依赖项嵌入到安装程序中并将其解压缩到临时目录以执行它。

Inno Setup can do this all for you, you typically do not need to code this yourself using Pascal Scripting. Inno Setup可以为您完成所有这些操作,您通常不需要使用Pascal Scripting自行编写代码。

[Run]
Source: "path\npp.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall

[Run]
Filename: "{tmp}\npp.exe"; Parameters: "/S"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM