NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

HOW To pass more than one numeric data with ActiveX postUIMessage

How to pass a numeric array with the ActiveX API.
I follow the example of OI Yield information for using UIMsg_UserMessage Base...
It says that we can pass additional data using the numeric data and string data parameters.
ARgument value
UIMsg_UserMessageBase+0
NumericDataPara 0
StringDataParam Parameters.Result Status
...
I would like to pass more than two or three numbers.
What should I do?
0 Kudos
Message 1 of 7
(4,389 Views)
Hi,

There are a couple ways you can do this.

A) Create a custom datatype that is a container that holds the amount of number values you want to pass. I.e. if you want to pass 3 numbers then you would have a container that has 3 number fields. You would then pass the container object reference via the ActiveX reference paramter and then strip out each value when you get the UIMessage in your OI.

B) Create an array of numbers and pass the array object reference via the ActiveX parameter of the UIMessage. Then you can use property object methods in your OI to get at the data.

Hope this helps!

Bob
Message 2 of 7
(4,389 Views)
Bob,
The second method seems simpler.
I use postUiMessageEX (not PostUIMessage) and in the section Parameters, there is an ActiveXDataParam. Highlight ActiveXDataParam,Click Edit Button, in the value field, type in Locals.numArray which is the array object reference. Am I doing it correctly?
0 Kudos
Message 3 of 7
(4,389 Views)
Hi trout00,

Sounds good to me. Give it a shot and let me know what happens.

Thanks!

Bob
0 Kudos
Message 4 of 7
(4,389 Views)
Hello Bob,

TestStand doesn't complain with activeXDataParam set to Locals.numArray.
At the other end in TestStand - Execution Display.VI, I connect at the output of TS.UIMessage->ActiveXData a Variant to Data with type input is a constant of numeric array and index the array to obtain the data.
I get error type mismatch and no data.
What a pain. Please help how to pass more than one number.
0 Kudos
Message 5 of 7
(4,389 Views)
Hi trout00,

You cannot convert the variant to an array of numbers. You must convert it to a PropertyObject reference. Then use PropertyObject methods and properties to extract information about the array. For example, PropertyObject.GetNumElements. Hope this helps!

Bob
0 Kudos
Message 6 of 7
(4,389 Views)
I've checked all the forum and all examples of TestStand and I couldn't see any code examples doing that in CVI.
 
I need to send an array of doubles to the Operator Interface by using PostUIMessageEx, here's my code that I couldn't manage to work:
 
 
CAObjHandle             tsThread = 0;
double                        measWave[100];
VARIANT                    tempVariant;
LPUNKNOWN           pArray;
ERRORINFO            errorInfo;
 
// measWave array filled with data
 
CA_VariantSet1DArray (&tempVariant, CAVT_DOUBLE, 100, measWave);
CA_VariantGetIUnknown (&tempVariant, &pArray);
 
TS_SeqContextGetThread (seqContextCVI, &errorInfo, &tsThread);
TS_ThreadPostUIMessageEx(tsThread, &errorInfo, TS_UIMsg_UserMessageBase + 1, 0, "", pArray, VTRUE);
 
 
 
it generates an error on function CA_VariantGetIUnknown (&tempVariant, &pArray);
 
with error code 0X80020005 (DISP_E_TYPEMISMATCH - Variant type does not match the type this function requires)
 
 
I'm not experienced on ActiveX and I need help to find a way to send an array of doubles to the Operator Interface as an activeX data parameter of PostUIMessageEx() function.
 
0 Kudos
Message 7 of 7
(4,045 Views)