LabVIEW 2018 Help
View Product Info
DOWNLOAD (Windows Only)
Use an automation refnum if you do not want to embed an ActiveX object or control in the LabVIEW front panel window.
Complete the following steps to call an ActiveX object from LabVIEW.
- Add an automation refnum control to the front panel window.
- Associate an ActiveX object with the automation refnum control.
- Right-click the control and select Select ActiveX Class»Browse from the shortcut menu to display the Select Object From Type Library dialog box.
- Select a type library from the top pull-down menu of the Select Object From Type Library dialog box.
- Select an object from the Objects box and click the OK button.
- Open a reference to the automation refnum.
- Add the Automation Open function to the block diagram.
- Wire the automation refnum to the Automation Refnum input of the Automation Open function.
- Access a property or invoke a method on the automation refnum.
- Add one of the following nodes to the block diagram.
- Wire the Automation Refnum output of the Automation Open function to the reference input of the node.
- Click the node to display a list of the properties or methods available for the referenced object.
||Note If LabVIEW does not display the properties or methods that you expect for the referenced ActiveX object, the object might implement multiple Component Object Model (COM) interfaces. LabVIEW can display the properties or methods from only one COM interface implemented by the object at a time. You can force LabVIEW to display the properties and methods from a different COM interface that the object implements by using the Variant to Data function to cast the automation refnum to the other COM interface.
- Select a property or method.
||Note Not all ActiveX objects expose methods.|
- Close the reference to the ActiveX object.
- Add the Close Reference function to the block diagram.
- Wire the reference out output of the Invoke Node to the reference input of the Close Reference function.
- Run the VI. The Automation Open function opens a reference to the ActiveX object you requested in the automation refnum control in the front panel window and performs the method you requested in the Invoke Node.