使用 Inno Setup 将 exe 文件注册为 OLE 服务器

Register an exe file as OLE server with Inno Setup

我想使用 Inno Setup 将 EXE 文件注册为 OLE 服务器。 当我在 cmd 中使用带有 Regserver 参数的 EXE 文件路径时,一切都是正确的。

但是当我像这样在 Inno Setup 中使用 regserver 标志时:

Source: "{src}\App\MyApp.exe"; DestDir: "{app}"; Flags: external regserver

我遇到了这个错误

Unable to register the DLL/OCX: Regsvr32 failed with exit code 0x4.

我该怎么办?

regserver flag 仅适用于 DLL/OCX 个文件。没有注册 EXE 文件的标准方法,因此 Inno Setup 无法在本地处理它,就像您不能对 EXE 文件使用 regsvr32 一样。

如果您的 EXE 文件具有用于注册的自定义 command-line 参数,请在 Run section:

的 Inno Setup 中使用它
[Run]
Filename: "{app}\MyApp.exe"; Parameters: "Regserver"