Guid to intPtr
-
Hi all! I have a small Interop question: I have a COM object that takes a structure as in-parameter. One of the fields in the structure is an IID*. When doing this in C++ the code: GUID rrid = __uuidof( _InterfaceName ); parStruct.riid = &rrid; works fine. How would I do this in C#? I have tried several things, but can´t get it to work. The type of the struct-field in C# is intPtr. And the only way I can find such a type, that I can think of, is: Type t = typeof( _InterfaceName ); System.RuntimeTypeHandle h = t.TypeHandle; parStruct.riid = h.Value; But I guess that I am way off here. Any one that can give me a hand here? Regards Mikke Added info: Hi again! I tried to create a C++ .Net project instead, just to try and find a work-around. When I took the COM objects needed and tried to import them into my brand new cpp project i got this error message: TlbImp warning: The type library importer could not convert the signature for the member 'RobEventParams.riid'. And a couple of other ones like this one for other similar parameter-structs with riid fields. What does that mean for me? Is it impossible to marshal something from .Net into this COM? The purpose is to set up a sink and recieve events from the COM object, to do this I should send a ref to an object that should recieve the events and the signature of an interface implemented in the receiver. It is the interface "signature" that is the riid, and also the problem here. When I execute my C# code above I get an exception telling me that "No such interface supported". Do I have to submit a non-.net method as a sink here? Best regards again / Mikke