Safearray, SafeArrayGetElement function

B

benk

Hello

I have create a Safearray of integer in Delphi,

ArrayBounds[0].lLbound := 0;
ArrayBounds[0].cElements := 1;
pArray := SafeArrayCreate(varVariant, 1, ArrayBounds);
if SafeArrayAccessData(pArray, ArrayData) = S_OK then
begin
OleString := 'Teststring';
SafeArrayPutElement(pArray, ArrayBounds, OleString);
SafeArrayUnAccessData(pArray);
end;

whene I wante to get this element from the safe array with the
SafeArrayGetElement function

getResult := SafeArrayGetElement(arr, Index, outString);
str := outString;
outString is empty (it not contain the 'Teststring')

Help me please
 
Top