NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How sharing a COM object with severeal test dlls in teststand

I have several tests (dlls) accessing a DAQ board (not VI compliant) thanks to a COM object. I would like to keep one instance of this object, passing its reference to each test dll, instead of creating one in each test. How can I do that with TestStand?
0 Kudos
Message 1 of 2
(2,567 Views)
You can do one of two things to store a reference to the COM object in the context of TestStand so that you can pass it to successive steps in order for them to all use the same object instance.

First, if you create the object in TestStand with an ActiveX Automation Adapter step, the method call to instantiate the object should return a reference to the object. If you designate an activex reference type local variable as the property to receive the reference during the creation operation, you should be able to pass this into methods that use IDispatch* parameters, or you can use the TestStand API to access the TestStand variable instead.

The second scenario is very similar, in that if you don't create the object in TestStand but inside of a dll instea
d, you can simply pass the parameter back from a function into a TestStand activex reference property variable or use the TestStand API inside of the dll to set the value of an activex reference property to the IDispatch of the object.

To better understand how to use the ActiveX Automation Adapter and ActiveX Reference Variable Types, look at Chapter 13 of the TestStand User Manual under the section entitled "ActiveX Automation Adapter". I have also attached an example to this post that uses the ActiveX Automation Adapter and ActiveX reference datatype in a sequence that writes data to a Microsoft Excel spreadsheet and generates a chart from the data.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 2
(2,567 Views)