How Do I Use an OCX File or ActiveX Custom Control in LabVIEW?

Updated Jun 6, 2023

Environment

Software

  • LabVIEW

Operating System

  • Windows

I have an ActiveX Custom Control in the form of an OCX File. How can I use this custom control and access its properties and methods using LabVIEW?

To use an OCX file in LabVIEW, first make sure your Active X Control is registered on the system. Please note that the ActiveX class and the LabVIEW development environment should have the same bitness. For example, if you installed a 32-bit ActiveX library you should call it with LabVIEW 32-bit. LabVIEW 32-bit cannot load a 64-bit ActiveX object into an ActiveX container because a 32-bit process cannot load a 64-bit process and vice-versa. 

Follow these steps to use your ActiveX library file in LabVIEW:
  1. Open the Controls Palette and select .NET & ActiveX >> ActiveX Container.
  2. Right-click the container and select Insert ActiveX Object.
  3. Select the desired OCX file from the list. The OCX file will appear in the list once it has been registered with the operating system.
  1. To access the properties and methods of an OCX, simply create a Property Node or an Invoke Node by right-clicking the output terminal of ActiveX Control on the block diagram and selecting Create >> Property for Class or Create >> Method for Class.

 Additional Information

OLE Control Extension (OCX) files are a custom file format which typically contain ActiveX custom controls. These files can be used to create and interact with custom controls in applications which support ActiveX and allow customization and reuse of user interface designs.

ActiveX containers also have an option to create an ActiveX object from a file. The "Create Control" drop down menu has an option for "Create Object From File"