I've seen the messages saying that when passing arrays to activex,
they get copied back and passed "down the line", but it's not working
for me.
I'm working on an activeX control(VC 6.0) that wants to copy some
numbers into a labview(or VB, or VC) array. This is that function:
void ACTIVEXCtrl::BufferedSafeArray(const VARIANT FAR& theBuffer)
{
SAFEARRAY* SABuffer; /* gets the hardware buffer */
SABuffer = theBuffer.parray;
/* if this isn't an array of longs, return */
if ( ! ( theBuffer.vt == (VT_ARRAY | VT_I4) ) )
return;
/* if this isn't a one-dimensional array, return */
if ( SafeArrayGetDim(theBuffer.parray) != 1 )
return;
USHORT* normBuffer; /* the sane representation of the array*/
/*lock array for use */
S
afeArrayAccessData(SABuffer, (void **) &normBuffer);
/*copy array */
for ( int i = 0; i < GetBufferSize(); i++)
normBuffer[i] = dBuffer[i];
/*give up control of safearray */
SafeArrayUnaccessData(SABuffer);
}
when running in debug mode in VC, i can see that the array is passed
into the function properly from the invoke node, and it copies the
data into the array properly within the C++ code. But once we're back
in labview, the data is the same as it originally was. I've got an
indicator wired to the output of the invoke node, and it still shows
the original value. This code works FINE when it's being called from
VC or VB. Is it the way I'm accessing the data in the activex
control?
Many Thanx
Sam Skuce