11-25-2013 03:45 AM
hi all,
I'm trying to pass a simple array that was created in locals at the sequence to a UI application.
I created an expression in NI:
RunState.Thread.PostUIMessageEx(10201,454,"this is my test",Locals.arr,True)
and in the application i implemented:
private void axApplicationMgr_UIMessageEvent(object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_UIMessageEventEvent e)
{
if (e.uiMsg.Event == (NationalInstruments.TestStand.Interop.API.UIMessageCodes)10201)
{
}
}
when the expression executed the UIMessageEvent happend and I get the numericData (454) and the stringData ( this is my test) but I don't know How to get the object reference of the array.
How can I cast the object ( e ) to get the array.
Tnx
11-25-2013 09:05 AM
NationalInstruments.TestStand.Interop.API.PropertyObject myArrayVariable = (NationalInstruments.TestStand.Interop.API.PropertyObject)e.uiMsg.ActiveXData;
You can then either use the teststand API to access the individual elements, or, if the array is an array of a basic type, you can do the following:
double[] myArray = (double[]) myArrayVariable.GetValVariant("", 0);
For more help with accessing arrays from .NET see the example: <TestStandPublic>\Examples\AccessingArraysUsingAPI\UsingDotNet\
-Doug
11-26-2013 12:45 AM
It working perfectly
Tnx a lot