views:

86

answers:

0

I have the following Delphi code:

var
 Stream: TMemoryStream;
 StreamI: TStreamAdapter;
 OleStream: IStream;
begin

 Stream:= TMemoryStream.Create;
 Stream.LoadFromFile(filename);
 StreamI:= TStreamAdapter.Create(Stream, soOwned);
 VSPDFViewer1.LoadStream(StreamI as IStream, '');
end;

Which actually passes an IStream object to a COM component. .NET has the "System.Runtime.InteropServices.ComTypes.IStream" interface, but I can't figure out a proper way to use it. How to initialize IStream with data and pass it to COM object in .NET?