Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
354 ratings:
 3.61 out of 5     Rate this Document

How Do I Register Type Libraries, ActiveX Controls, and ActiveX Servers?

Primary Software: Measurement Studio>>Measurement Studio for Visual Basic 6
Primary Software Version: 3.0.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

How do I manually register type libraries (.TLB), ActiveX controls (.OCX), and ActiveX servers (.DLL and .EXE)?


Type Libraries
Type libraries are binary files that contain all of the type information needed to utilize the procedures and classes in a .DLL. To register a type library, you should use regtlib.exe as follows:
  1. Navigate to the following folder and copy the file path to clipboard:

    (the actual folder path may be different depending on the .NET Framework version installed on your computer.)
    Note: This may also be located in C:\WINDOWS\system32\URTTemp\regtlib.exe
  2. Select Start » Run.
  3. Type the full location of this executable into the box that appears such as:
      "<Full path of .TLB file>"

    where "<Full path of .TLB file>" is the location of your type library file with quotations.
  4. Click OK.

ActiveX Controls
ActiveX controls are files with a .OCX extension. These controls come in 16-bit and 32-bit forms, with 32-bit being the most common. To register an ActiveX control, you should use regsvr32.exe as follows:
  1. Select Start » Run.
  2. Type the following in the dialog box that appears:
    regsvr32 "<Full path of .OCX file>"
    where "<Full path of .OCX file>" is the location of your ActiveX control including the quotes.

Note: If you have a 16-bit control, you should run regsvr instead of regsvr32. If your ActiveX control is registered incorrectly, you must first unregister it and then register it again.

You will get a dialog box prompting you that your control has been unregistered or registered successfully. To unregister a control, use the switch /u (regsvr32 /u "<Full path of .OCX file>").

ActiveX Servers
ActiveX servers can be in the form of dynamic link libraries (.DLLs) and executables (.EXEs). DLLs are registered like an ActiveX control with regsvr32 as in the previous section. However, when registering an .EXE, you must use call the .EXE file with the switch /RegServer as follows:

  1. Select Start » Run.
  2. Type the following in the dialog box that appears:
    <Full path of the .EXE file> /RegServer
    where <Full path of the EXE file> is the location of your EXE server (C:\TestStand\Bin\REngine.exe /RegServer).

To unregister an EXE ActiveX Server use the switch /UnRegServer (C:\TestStand\Bin\REngine.exe /UnRegServer).

Note: If you find that you are dealing extensively with type libraries, ActiveX controls, and ActiveX servers, you may find the utility linked below useful. It is a very simple utility that allows you to quickly register and unregister type libraries, ActiveX controls, and ActiveX servers. The application is distributed freely by the Common Controls Replacement Project (CCRP), and the readme file included with the application explains how to use it.

Related Links:
Common Controls Replacement Project
KnowledgeBase 2XDAB1SJ. Why Does regsvr32.exe Register my .ocx File From the Incorrect Directory?
KnowledgeBase 417EP44G: How Do I Use an OCX File in LabVIEW?



Report Date: 01/12/1999
Last Updated: 12/27/2011
Document ID: 1HBAMMSR

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit