NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Varient Array

Hi,
I am using a the ActiveX module adapter to call a method, and have run into an interesting problem. One of the modules of the method I would like to call is of type "array of variants by ref" and each of the varients in the array can be a different type. Is it possible for me to pass this information into the method, and if so how?
0 Kudos
Message 1 of 2
(3,415 Views)
Hi Jackson,

TestStand does not have an intrinsic VARIANT datatype that you can create variables and properties with directly. However, there are some limited cases where you can basically construct variants to be passed to external code. Before explaining how you might go about accomodating this method's parameter typedef, it would be best to point out that since TestStand does not have any facility for creating VARIANT data (variables/properties) it is somewhat difficult to do this and the approach you take should be carefully thought through. Your options are as follows:

1) Create a wrapper DLL for your code module with a function that takes in single TestStand intrinsic datatypes (numeric, string, boolean, ActiveX reference), one for each index in your resulting array you need to pass and construct the array inside of the DLL using more convenient methods such as those exposed by the Windows Platform SDK Automation API. Then have the wrapper DLL function call your automation server's method internally, passing the new array to it.

2) You can (with some limitation) create a TestStand container type that has the same makeup as an ActiveX VARIANT structure type so that the container can then be passed to external code as an actual variant. With this idea, it can be summised that if you created the most basic container type with just the first 4 fields of the VARIANT structure defined within it, you could then create an array of this container type. Now, once you have an array of this generic pseudo-variant container type, you can use the TestStand API's PropertyObject.SetValNumber/SetValString/etc... methods with the "InsertIfMissing" option to add the actual data for the VARIANT to the container. This will actually insert an additional property into each specific index's container to signify the different data that each variant possesses. Obviously the limitations here lie within the intrinsic datatypes that TestStand will allow you to insert as the data for the variant as well as not really being able to specify pointer types for the data member either.

For more information the TestStand API methods mentioned above look at the TestStand Programmer's Help accessible through the Sequence Editor's Help menu.

For more information on the VARIANT structure type definition and variant manipulation functions visit the following Microsoft Developer Network SDK documentation pages:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap6_7zdz.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap7_5alv.asp

For more information on creating wrapper DLLs to use with TestStand visit the following National Instruments Example Program Database page:

http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3D9B956A4E034080020E74861&p_node=DZ52195&p_submitted=N&p_rank=&p_answer=&p_source=External

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
Message 2 of 2
(3,415 Views)