Novell is now a part of Micro Focus

Programmatically Registering ActiveX Controls

Articles and Tips: tip

Wolfgang Schreiber
Novell, Inc.

01 May 2002


If you want to deploy Novell ActiveX controls, you need to register the control on the target station. You achieve this by installing the whole set of controls that use the installation routine that comes with the Novell controls. Since this installation includes sample code, documentation and all controls, you may prefer to run a custom installation of selected OCX files.

This can be done in one of two main ways:

  1. Use the REGSRV32 utility from the command line of from within your application with a call like:

    WinExec(PChar('regsvr32 /s my.ocx'), SW_HIDE);
  2. Use the OCX internal registration functions with something like this (Delphi sample):

uses ActiveX;
    
function RegisterControl(sFileName: String): boolean;
    
var
        Hdl             : THandle;
        RegServer : TDllRegisterServer;
begin 
        Hdl             := LoadLibrary(pChar(sFileName));
        RegServer := GetProcAddress (Hdl, 'DllRegisterServer');
        result    := (RegServer=0);
        FreeLibrary (Hdl);
end; 
    
procedure TForm1.Button1Click(Sender: TObject);
begin
        if RegisterControl('C:\Novell\Activex\nwsrva.ocx') then ShowMessage('OK');
end;

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates