LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SafeArray in LabView

Hi,
I hope someone will be able to help me with this.

I made an ActiveX that will be used in LabView. Originally, the
method of the ActiveX was returning a user-defined structure. In
LabView, this method is grayed out when I right-click the component
because it doesn't return a valid type.

So I made a SafeArray. The pvData member of the SaafeArray points to
my structure. I have embedded this structure in a Variant of type
array of bytes (VT_UI1 | VT_ARRAY) and my method now return this
Variant.

LabView now recognize my method, but I need to have access to the
pvData of the SafeArray by calling SafeArrayAccessData from the Win32
API (OLEAUT32.dll). The prototype of this function is the following:

HRESULT SafeArrayAccessData(SAFEARRAY *psa, void
HUGEP **ppvData);

What is the correct prototype in LabView?

I tried something that didn't work...

In LabView, I wired the output of my method in the Input of a G Data
vi. In the Type of G Data vi, I wired a cluster maps on the SAFEARRAY
structure. The output of the G Data vi should be the my SafeArray, right? I
got an error when trying to run it.

I debug a little and find out that the output of the G Data vi is
null, but the input is ok, so what am I doing wrong?

It will really help me if someone can give an example of how to use
SafeArray in LabView.

Thanks,
Michael


--


Michael Grimard
Concepteur Logiciel/Software Designer
MAX Technologies
michaelg@maxt.com
tel:(450)443-3332 #524
0 Kudos
Message 1 of 1
(2,674 Views)