Search code examples
inno-setupoleregsvr32

Register an exe file as OLE server with Inno Setup


I want to register an EXE file as OLE server with Inno Setup. When I use my EXE file path with Regserver parameter in cmd, everything is correct.

But when I use the regserver flag in Inno Setup like this:

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

I got this error

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

What should I do?


Solution

  • The regserver flag is for DLL/OCX files only. There's no standard way to register EXE files, so it cannot be handled natively by Inno Setup, the same way you cannot use regsvr32 with an EXE file.

    If your EXE file has a custom command-line parameter for the registration, use it in Inno Setup in the Run section:

    [Run]
    Filename: "{app}\MyApp.exe"; Parameters: "Regserver"