Need an IStream object for COM, help please!

  • Thread starter Thread starter Kourosh
  • Start date Start date
K

Kourosh

Hi all,
I'm trying to call a COM function from C#
The function gets a paramter of type IStream in C++. I've found the
type System.Runtime.InteropServices.ComTypes.IStream, however I'm not
sure how to create an instance of it to pass as the parameter. Anyone
can tell me what to do? i dont know what to pass in as the parameter,
because I'm not sure how to create an instance of the "IStream" object
in C#
 
Kourosh,

In COM, IStream is not an object, but an interface. You have to
implement that interface on a class, and pass that implementation to the
method to be acted upon.
 
oh yea oops :D
so there is no easy way in C# to perhaps use the Stream class, or any
built in COM object from .NET for this purpose?


Kourosh,

In COM, IStream is not an object, but an interface. You have to
implement that interface on a class, and pass that implementation to the
method to be acted upon.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hi all,
I'm trying to call a COM function from C#
The function gets a paramter of type IStream in C++. I've found the
type System.Runtime.InteropServices.ComTypes.IStream, however I'm not
sure how to create an instance of it to pass as the parameter. Anyone
can tell me what to do? i dont know what to pass in as the parameter,
because I'm not sure how to create an instance of the "IStream" object
in C#- Hide quoted text -

- Show quoted text -
 
You could create a wrapper which maps the IStream implementation to the
methods on Stream (there isn't a one-to-one correspondence between the
methods on IStream and Stream, but it shouldn't be hard).

However, it depends on what you are trying to feed the method. What is
it that you have the data in which you want the method to access through the
IStream?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Kourosh said:
oh yea oops :D
so there is no easy way in C# to perhaps use the Stream class, or any
built in COM object from .NET for this purpose?


Kourosh,

In COM, IStream is not an object, but an interface. You have to
implement that interface on a class, and pass that implementation to the
method to be acted upon.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Hi all,
I'm trying to call a COM function from C#
The function gets a paramter of type IStream in C++. I've found the
type System.Runtime.InteropServices.ComTypes.IStream, however I'm not
sure how to create an instance of it to pass as the parameter. Anyone
can tell me what to do? i dont know what to pass in as the parameter,
because I'm not sure how to create an instance of the "IStream" object
in C#- Hide quoted text -

- Show quoted text -
 
Back
Top