IStream System::Object^ question

Hi,
I did a reference to a DLL and I am trying to use a method that requires a System::Object^ as a parameter.

When I create the variable and call the method, I get an error saying that is expecting a IStream Object.

When I create the IStream variable and add it to the method the intellisense tells me that is no conversion from std::istringstream to system::object^

The help on the DLL says this:
Currently, this must pass an object that supports IStream

Can anybody explain how to do this?

This is the method:
void SetSOAPPayload(System::Object^ vtSOAPPayload)


And this is the info for the method:
Sets the SOAP payload data to be sent with the request. Currently, this must pass an object that supports IStream.

Thank you,
Antonio
That .DLL sounds like it is lousy. Such a dependency should not be expressed in the documentation, it should be enforced by the type-safety features of the language. If it really needs an IStream object, then I'd expect the method signature to look like this:
void SetSOAPPayload(WhateverNamespaceIStreamBelongsTo::IStream^ vtSOAPPayload);

I would have to see more code to be sure about your problem. What object are you trying to pass to that method? What is the actual type of that object? How are you creating it?

EDIT: After re-reading your post, it sounds like you tried to create an IStream object and initialize it with an object of std::istringstream. You're going to have to do that by hand. I doubt that it is built into C++/CLI.
Last edited on
I agree, and there is not a lot of information from the vendor about this DLL.

So I cannot change the code in the DLL, I have to work with it the way it is.

So... based on what I have, I need a System::Object^ that supports IStream.

How do I create this object? I am doing a lot of research and I cannot find how to do this object with this characteristics.

Thank you,
Antonio
Check out this page https://social.msdn.microsoft.com/Forums/en-US/7b2fa9d6-6294-49a5-a5a3-c4d3e51f0f1e/creating-an-istream-object
and this page http://msdn.microsoft.com/en-us/library/windows/desktop/aa378980%28v=vs.85%29.aspx

I'm sure you've already seen both of these, but I think they'll be the most helpful. It looks like you will somehow have to put whatever is in your stringstream into a byte array (array of char or __int8 since it is MS specific). Use the
GlobalAlloc function (http://msdn.microsoft.com/en-us/library/windows/desktop/aa366574%28v=vs.85%29.aspx)
to get a handle to some native memory and copy the byte array to it. Then pass this global handle to
CreateStreamOnHGlobal (http://msdn.microsoft.com/en-us/library/windows/desktop/aa378980%28v=vs.85%29.aspx),
along with an instance of an IStream. After this call, the IStream parameter passed in should be properly initialized. Pass this IStream into the SetSOAPPayload method.
Last edited on
thank you, let me check the links and I will post back my results.
Registered users can post here. Sign in or register to post.