[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.interop

COM Server and object type

wpcmame

11/7/2007 8:51:00 PM

I have a .net assembly that also acts as a COM server.

In this assembly I got a few methods that accepts an object argument like
this:

void member(object arg)

Do I need to do special treatment for the argument when called from COM?

The question came up when someone called the method from excel with a cell
object.

i.e. mycomobject.method(Cells(2,3))

My questions are now:
1. I assume the Cell object goes through the CCW when entering the managed
world. Does this mean that I should do a FinalReleaseComObject?

Something like
if (Marshal.IsComObject(arg)) Marshal.FinalReleaseComObject(arg);

2. Is it possible to know if the call comes from the CCW? How do I otherwise
know if the object should be released.

3. The intension of the caller was of course to do "Cells(2,3).Value" but
since Value is the default property it is easy to forget.
How do I handle this in my method? Can I somhow call the default property on
the managed object?