LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Safearray of Records from ActiveX object

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

 

0 Kudos
Message 1 of 6
(3,730 Views)
Will it convert to an array of variants?

Mike ...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 6
(3,726 Views)

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

0 Kudos
Message 3 of 6
(3,716 Views)
Can you run your vi so the variant you area trying to save is in an indicator, set that value as the default for the indicator, save the vi and post the result?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 6
(3,708 Views)

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

 

 

Download All
0 Kudos
Message 5 of 6
(3,706 Views)

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!

 

 

 

 

Aldo A
Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(3,680 Views)