Pascal Scripting: RegisterServer

Prototype:

procedure RegisterServer(const Is64Bit: Boolean; const Filename: String; const Reserved: Boolean);

Description:

Registers the DLL/OCX with the specified filename. Raises an exception if not successful.

Is64Bit specifies whether the DLL/OCX is 64-bit (True) or 32-bit (False).

Parameter Reserved is ignored, but must be specified anyway.

Remarks:

Filename must be reachable in the current process. This means, for example, that a 32-bit installer wanting to register a DLL in the native 64-bit {sys} directory must pass a Sysnative path. Use ApplyPathRedirRules as shown in the example below to make that adjustment automatically. (Calling ApplyPathRedirRules for DLLs outside of {sys} isn't necessary, but it doesn't hurt.)

Example:
var
  File64Bit: Boolean;
begin
  // Register hhctrl.ocx located in the System directory.

  // Setting File64Bit to...
  // - False will register the 32-bit OCX in the 32-bit System directory
  // - True will register the 64-bit OCX in the 64-bit System directory
  // - Is64BitInstallMode will use Setup's install mode to determine which one to register
  File64Bit := Is64BitInstallMode;

  RegisterServer(File64Bit,
    ApplyPathRedirRules(File64Bit, ExpandConstant('{sys}\hhctrl.ocx'), tpCurrent),
    False);
end;