VarArrayLock
Locks a variant array and returns a pointer to the data
procedure Variant2Stream(const v: OleVariant;
Stream: TMemoryStream);
var
p: Pointer;
begin
Stream.Position := 0;
Stream.Size := VarArrayHighBound(v, 1) - VarArrayLowBound(v, 1) + 1;
p := VarArrayLock(v);
try
Stream.Write(p^, Stream.Size);
finally
VarArrayUnlock(v);
end;
Stream.Position := 0;
end;