How do I declare an IStream in idl so visual studio maps it to s.w.interop.comtypes?
- by Grahame Grieve
hi
I have a COM object that takes needs to take a stream from a C# client and processes it. It would appear that I should use IStream. So I write my idl like below. Then I use MIDL to compile to a tlb, and compile up my solution, register it, and then add a reference to my library to a C# project.
Visual Studio creates an IStream definition in my own library. How can I stop it from doing that, and get it to use the COMTypes IStream? It seems there would be one of 3 answers:
add some import
to the idl so it doesn't redeclare IStream (importing MSCOREE does that, but doesn't solve the C# problem)
somehow alias the IStream in visual studio - but I don't see how to do this.
All my thinking i s completely wrong and I shouldn't be using IStream at all
help...thanks
[
uuid(3AC11584-7F6A-493A-9C90-588560DF8769),
version(1.0),
]
library TestLibrary
{
importlib("stdole2.tlb");
[
uuid(09FF25EC-6A21-423B-A5FD-BCB691F93C0C),
version(1.0),
helpstring("Just for testing"),
dual,
nonextensible,
oleautomation
]
interface ITest: IDispatch
{
[id(0x00000006),helpstring("Testing stream")]
HRESULT _stdcall LoadFromStream([in] IStream * stream, [out, retval] IMyTest ** ResultValue);
};
[
uuid(CC2864E4-55BA-4057-8687-29153BE3E046),
noncreatable,
version(1.0)
]
coclass HCTest
{
[default] interface ITest;
};
};