how to convert stream to oleVariant and then come back?

how to convert stream to oleVariant and then come back?

Post by ari » Sun, 28 Nov 2004 17:36:58


hi all,
In my project, I need to convert a filestream or a StringStream to
oleVariant, and then pass through from a DCOM SERVER, and then come back at
Client application, how can I do it?

regards,
Ari
 
 
 

how to convert stream to oleVariant and then come back?

Post by David Lewi » Sun, 28 Nov 2004 19:40:17

function TServerProgram.GetFile: OleVariant;
var
AStream: TFileStream;
MyBuffer: Pointer;
begin
Try
AStream := TFileStream.Create( <FileName>, fmOpenRead );
Result := VarArrayCreate( [0, AStream.Size - 1], VarByte );
MyBuffer := VarArrayLock( Result );
AStream.ReadBuffer( MyBuffer^, AStream.Size );
VarArrayUnlock( Result );
Finally
AStream.Free;
End;
end;






at

 
 
 

how to convert stream to oleVariant and then come back?

Post by ari » Mon, 29 Nov 2004 01:54:47

Thanks to David Lewis very much, I solved my problem now!

Regards,
Ari

"David Lewis" < XXXX@XXXXX.COM > : XXXX@XXXXX.COM ...