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.
- Place the Automation Open function on the block diagram.
- Wire the automation refnum to the Automation Refnum input of the Automation Open function.
- Invoke a method on the automation refnum.
- Place the Invoke Node on the block diagram.
- Wire the Automation Refnum output of the Automation Open function to the reference input of the Invoke Node.
- Right-click the Invoke Node and select Select Method from the shortcut menu to display the Select Method dialog box.
- Select a method from the Methods and Dottable Properties tree on the Select Method dialog box.
- Click the OK button to select the method.
 |
Note Not all ActiveX objects expose methods. |
- Close the reference to the ActiveX object.
- Place the Close Reference function on 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.
Refer to the Slideshow VI in the labview\examples\comm\actxpp.llb for an example of calling an ActiveX object from LabVIEW.