Marshalling Question

  • Thread starter Thread starter Beringer
  • Start date Start date
B

Beringer

Is it possible to marshal a FileStream or StreamReader object in C#?
Ok the real question is: How dow you marshal the above objects?
I've been trying all different ways and haven't figured it out.

Thanks in advance,
Eric
 
Is it possible to marshal a FileStream or StreamReader object in C#?
Ok the real question is: How dow you marshal the above objects?

Marshal to what/where?



Mattias
 
I want to marshal the object for Interop and P/Invoke.
I need to marshal a structure that contains a StreamReader object. This
structure is a the WPARM of SendMessage Window's API.
I wanted to know what MarshalAs attribute to apply. That is if it is possible.

Thanks
Eric
 
Beringer said:
I want to marshal the object for Interop and P/Invoke.
I need to marshal a structure that contains a StreamReader object. This
structure is a the WPARM of SendMessage Window's API.
I wanted to know what MarshalAs attribute to apply. That is if it is
possible.

Marshal the file handle as a IntPtr.

But file handles are local to your process, so unless the target of
SendMessage is a window in your process (in which case, why use SendMessage.
.. .), I'm afraid you're out of luck.

David
 
You know I thought of that, but I figured that by nature, StreamReader being
an object, more than just the Handle would be needed.
So your saying that I can marshal the file handle of the StreamReader and be
OK?
Eric
 
Although I thought about using a handle; I have no idea how to get a file
handle from a StreamReader. I don't see any methods or properties to do this.

Thanks,
Eric
 
Please disrgard last post; I'm an idiot:)
Eric

David Browne said:
Marshal the file handle as a IntPtr.

But file handles are local to your process, so unless the target of
SendMessage is a window in your process (in which case, why use SendMessage.
.. .), I'm afraid you're out of luck.

David
 
Back
Top