Board index » delphi » IStream - anybody having an example?

IStream - anybody having an example?

Hi all,

I am trying to use the IStream interface and I run in all sorts of issues -
most probably because I am new in the area. Can anyone help me with an
example of how to use this interface or wheere to find some documentation
about this?
Thank you

 

Re:IStream - anybody having an example?


How and for what are you trying to use it?

Stuart

Quote
Luchian wrote in message <6uohim$jc...@forums.borland.com>...
>Hi all,

>I am trying to use the IStream interface and I run in all sorts of issues -
>most probably because I am new in the area. Can anyone help me with an
>example of how to use this interface or wheere to find some documentation
>about this?
>Thank you

Re:IStream - anybody having an example?


Kraig Brochschmidt's Inside OLE 2 has examples on IStream as well as a lot of
other OLE Interfaces.

--
-Adam
Delphi Developer Support

Due to my workload, personal email more than likely won't get a
reply.

Support options are detailed at http://www.inprise.com/devsupport/
I am unable to answer support questions via email at this time.

Quote
Stuart C. Naifeh wrote:
> How and for what are you trying to use it?

> Stuart

> Luchian wrote in message <6uohim$jc...@forums.borland.com>...
> >Hi all,

> >I am trying to use the IStream interface and I run in all sorts of issues -
> >most probably because I am new in the area. Can anyone help me with an
> >example of how to use this interface or wheere to find some documentation
> >about this?
> >Thank you

Re:IStream - anybody having an example?


The client app needs a lot of information from the server (one or more
records) - I am trying to send this as a bunch of bytes via an IStream
interface (I hope this is doable...)
Quote
Stuart C. Naifeh wrote in message <6ur4kk$n...@forums.borland.com>...
>How and for what are you trying to use it?

>Stuart

>Luchian wrote in message <6uohim$jc...@forums.borland.com>...
>>Hi all,

>>I am trying to use the IStream interface and I run in all sorts of
issues -
>>most probably because I am new in the area. Can anyone help me with an
>>example of how to use this interface or wheere to find some documentation
>>about this?
>>Thank you

Re:IStream - anybody having an example?


Hello,

You should be able to easily use the TStreamAdapter class (Classes.pas) to
wrap any TStream descendant and export it through IStream. Another method is
to use a variant array of bytes, which might be simpler to program.

have fun,
--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
Luchian wrote in message <6urggi$nd...@forums.borland.com>...
>The client app needs a lot of information from the server (one or more
>records) - I am trying to send this as a bunch of bytes via an IStream
>interface (I hope this is doable...)
>Stuart C. Naifeh wrote in message <6ur4kk$n...@forums.borland.com>...
>>How and for what are you trying to use it?

>>Stuart

>>Luchian wrote in message <6uohim$jc...@forums.borland.com>...
>>>Hi all,

>>>I am trying to use the IStream interface and I run in all sorts of
>issues -
>>>most probably because I am new in the area. Can anyone help me with an
>>>example of how to use this interface or wheere to find some documentation
>>>about this?
>>>Thank you

Re:IStream - anybody having an example?


I discovered TStreamAdapter too, - not too much documentation on it, or at
least not enough for me, though. So far I created a couple of COM apps using
the Delphi wizards - I don't know how I can use this class (TStreamAdapter)
to build my own coclass - the wizard choices are limited (I believe to
TAutoClass and another one...) Or better say, yes, I can build a descendant
of the TStreamAdapter (TMyStream), which would use the TMemoryStream as the
data storage TStream. At the other end (Client side) I would like to use
TOLEStream to read this stream. How can I publish/register the TMyStream
class? Then, to create an instance, so far I had the TLB file (the wizard
provided me with) which contained the coclass create function, but now?
Should I get down to COM api and use CoCreateInstance?! So far the wizard
did that for me...

Quote
bly wrote in message <6us7g7$o8...@forums.borland.com>...
>Hello,

>You should be able to easily use the TStreamAdapter class (Classes.pas) to
>wrap any TStream descendant and export it through IStream. Another method
is
>to use a variant array of bytes, which might be simpler to program.

>have fun,
>--
>Binh Ly
>Brickhouse Data Systems, Inc.
>http://www.brickhouse.com

Re:IStream - anybody having an example?


Hello,

You don't need to make a COM-creatable object to use TStreamAdapter.
TStreamAdapter is a class that you can use to export a TStream data using
the IStream interface. For example:

type
  TServerObject = class (TAutoObject, IServerObject)
    FData : TStream (descendant);
    procedure GetData (out Stream : IUnknown)
  end;

procedure TServerObject.GetData (out Stream : IUnknown);
begin
   Initialize FData stream with info to pass to client;
   Stream := TStreamAdapter.Create (FStream) as IUnknown;
end;

on client end:

var
  Stream : IUnknown;
  OleStream : TOleStream;
begin
  ServerObject.GetData (Stream);
  OleStream := TOleStream.Create (Stream as IStream);
  Parse data from OleStream;
  OleStream.Free;
end;

All code is untested but you get the idea.

have fun,
--
Binh Ly
Brickhouse Data Systems, Inc.
http://www.brickhouse.com

Quote
Luchian wrote in message <6uu8kk$s...@forums.borland.com>...
>I discovered TStreamAdapter too, - not too much documentation on it, or at
>least not enough for me, though. So far I created a couple of COM apps
using
>the Delphi wizards - I don't know how I can use this class (TStreamAdapter)
>to build my own coclass - the wizard choices are limited (I believe to
>TAutoClass and another one...) Or better say, yes, I can build a descendant
>of the TStreamAdapter (TMyStream), which would use the TMemoryStream as the
>data storage TStream. At the other end (Client side) I would like to use
>TOLEStream to read this stream. How can I publish/register the TMyStream
>class? Then, to create an instance, so far I had the TLB file (the wizard
>provided me with) which contained the coclass create function, but now?
>Should I get down to COM api and use CoCreateInstance?! So far the wizard
>did that for me...

>bly wrote in message <6us7g7$o8...@forums.borland.com>...

Other Threads