Hello eyver,
You are correct that the VARIANT FAR* ScaledData parameter contains a 2D array. In Visual C++, this is a SAFEARRAY datatype, so you can deal with it as you would any other VARIANT containing a 2D-SAFEARRAY:
// Get the pointer to the 2D-SAFEARRAY which is stored in the VARIANT ScaledData.
SAFEARRAY* parray = ScaledData->parray;
double dbl;
HRESULT hresult;
// Get the value out of the SAFEARRAY stored at element 0,0 (0 = first channel, 0 = value index)
long indices[2] = { 0,0 };
hresult = SafeArrayGetElement(parray, indices, &dbl);
if FAILED(hresult) {
// handle error here
return;
}
// Now get the value out of the SAFEARRAY stored at element 1,10 (1 = second channel, 10 = value index)
long indices2[2] = { 1,10 };
hresult = SafeArrayGetElement(parray, indices2, &dbl);
if FAILED(hresult) {
// handle error here
return;
}
Microsoft Visual C++ provides other SAFEARRAY functions to you, including SafeArrayGetLBound, SafeArrayGetUBound, and SafeArrayCopy, which you can learn more about at http://msdn.microsoft.com.
David Mc.
NI Applications Engineering