1 2 {=== Read the contents of a Safe array into a delimited string ===}3 function ReadSafeArray(raedArray : PSafeArray; delimiter : string=#13#10):string;
4 var5 i, cmx, cmin : Integer;
6 wsRead : WideString;
7 begin8 Result := '';
9 wsRead := '';
10 11 if raedArray<>nilthentry12 13 //-- Get array dimensions --\\14 SafeArrayGetUBound(raedArray, 1, cmx);
15 SafeArrayGetLBound(raedArray, 1, cmin);
16 17 //-- Collect the array items to the result string}18 for i := cmin to cmx dobegin19 20 SafeArrayGetElement(raedArray, i, wsRead);
21 22 if i<cmx then23 Result := Result + wsRead + delimiter
24 else25 Result := Result + wsRead ;
26 27 end;//-- For i := cmin --\\28 29 except30 end; //-- if raedArray<>Nil Try..except --\\31 end;//-- Function ReadSafeArray( --\\32 //---------------------------------------------------------------------\\