03-05-2012 03:54 PM
Hi
I am trying to access an array of user defined types returned by a COM object in LV using ActiveX Invoke function and i am unable to make it work.
After the Invoke, I see the type returned is VT_ARRAY|VT_UNKNOWN, but Mapping to an array of clusters using VariantToData.vi crashes LV.
I could see the data returned successfully using a C++ client
My question is
1) Is it possible to access a SafeArray of UDTs returned from a COM object in LV ?
2) How do I do it ?
Any help is greatly appreciated.
Biju
03-06-2012 01:29 AM
03-06-2012 09:45 AM
I tried the input type of VariantToData as an array of Variant, still LV crashes with Access Violation.
If i increase the array dimension to 2, it will not crash, but gives a type mismatch error.
Biju
03-06-2012 10:13 AM
03-06-2012 11:00 AM
Hi Mike,
I have attached pics of front panel and block diagram connecting the output directly to an indicator.
Iam using LV 2010.
The COM Server is an exe not a dll (sepearte process).
I tried another method that returns a safearray of double and it displays data correctly - and the type shows as VT_ARRAY| VT_R8
I am thinking that LV is not able to access the IRecordInfo interface to access the cluster (UDT) information ?. - hence the type is VT_ARRAY | VT_UNKNOWN
instead of VT_ARRAY | VT_RECORD
Thanks for the replies,
Biju
03-07-2012 12:15 PM
Hi Biju,
It sounds that LV is not recognizing the input data type. Take a look at this NI Community post on how you can programmatically determine the LabVIEW data type using the GetTypeInfo VI and then operate on that data using LV. In addition, you will probably need to use the GetArrayInfo to determine the array element data type.
https://decibel.ni.com/content/docs/DOC-10524
Modify the code to fit your application. Hope this helps!