Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Need an IStream object for COM, help please!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kourosh - 20 Oct 2007 23:39 GMT
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#
Nicholas Paldino [.NET/C# MVP] - 21 Oct 2007 03:02 GMT
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.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi all,
> I'm trying to call a COM function from C#
[quoted text clipped - 4 lines]
> because I'm not sure how to create an instance of the "IStream" object
> in C#
Kourosh - 21 Oct 2007 03:26 GMT
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,
>
[quoted text clipped - 16 lines]
>
> - Show quoted text -
Nicholas Paldino [.NET/C# MVP] - 21 Oct 2007 03:45 GMT
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?

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> oh yea oops :D
> so there is no easy way in C# to perhaps use the Stream class, or any
[quoted text clipped - 20 lines]
>>
>> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.