[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.interop

Getting Active COM object, which is a .NET component

googler

11/21/2006 3:41:00 PM


Hi,
simple but tricky ... i want to establish a proper communication
between a .NET class and a COM object.

A .NET class X uses the COM object Y and calls on , e.g Y.COMMethod().
The interface of class X is exposed via Interop to the COM world.. so
there's a CCW for it.

In the Y.COMMethod() i'd like to call a method on the .NET object X,
e.g. X->NETMethod().
It is possible, but the call in Y uses ::CoCreateInstance and creates
the .NET object always new.

Is it possible to get the running X (where the call came from) by using
GetActiveObject in the unmanaged object Y ?? How to do this ?

Another approach would be, that the COM object Y calls the .NET object
with X-->NETMethod(), and the NETMethod-method gets the running
instance of Y with Interop.Marshal.GetActiveObject (..) . This is not
working as well.:(

Every comment is very welcome!