to access the data from a safe array: 1. you must know the number of dimentions it has use SafeArrayGetDim () int iDim = SafeArrayGetDim (someSafeArray); 2. You have to know bounds, lets read them into the minIndex and maxIndex, lets assume that your array is 1 dimentional arraylong minIndex, maxIndex; SafeArrayGetUBound (someSafeArray, 0, &maxIndex);SafeArrayGetLBound (someSafeArray, 0, &minIndex); 3. Lets get the data type of the element in the array VARTYPE vt;SafeArrayGetVartype (someSafeArray, &vt); 4. Lets assume yours is an array of ULONG ULONG *pData; if(vt ==VT_UI4){ SafeArrayAccessData (someSafeArray, &pData); for (int i = minIndex; i < maxIndex; i++) { printf("%d", pData[i]); } SafeArrayUnaccessData (someSafeArray); } Regards, Pratap
Proposed as answer by
Raja Pratap Reddy
Friday, September 5, 2008 1:00 PM
Marked as answer by
Yan-Fei Wei
Tuesday, September 9, 2008 9:03 AM