[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Help me consume an IUnknown * out,retval parameter in .NET

Jeffrey Dean

3/14/2007 3:31:00 AM

Hello all,
In learning to use COM interop, I've run into a problem...

I have a .NET app where I am trying to consume two unmanaged, C++ COM
objects built with ATL. I can consume either COM object from managed code
using their interop assemblies. Further, and both unmanaged objects expose
ATL's implementation of IProvideClassInfo.

My problem arises when one of the unmanaged COM objects (object A) creates
an instance of the other unmanaged object (object B) and returns its
IUnknown * as an out/retval parameter back to managed code. Despite my best
efforts, the CLR wraps it as a System.__ComObject and I cannot cast it the
desired type.

I am not sure what I've missed so the CLR can properly handle the IUnknown*
passed back to it. I've tried some trick I saw on this group but no luck so
far.

Thanks in advance for any help,
Jeff