tags:

views:

56

answers:

1

I have a third party assembly with a public abstract class implementing a certain COM interface. Something to the effect of

[ComVisible(true)]
public abstract class SomeClass: ISomeInterface
{
  ....
  public void Method1() {...}
}

The actual object is an internal object extending the SomeClass and is instantiated by the third party code

Is there a way to access public methods of this class if all I have is the CCW to the ISomeInterface?

To clarify my question:

I am building a flavored Visual Studio project extending the F# project system. Both my code and F# project system are managed, but there is a lot of unmanaged code between us. In my project manager I am getting a pointer (IntPtr) to the F# project manager and I can cast it to a number of interfaces F# project manager implements, but I need to call a (public) method on the project manager itself and so far I could not find a way to do that

A: 

Generally, no. You can only get at methods in this COM interface and other COM interfaces on the same object.

sblom
Well, this object is marked with ComVisible(true), which AFAIK implies that it should have class interface - should it not?
mfeingold
An IntPtr? Is it even a COM interface pointer? Maybe Marshal.GetObjectFromIUnknown().
Hans Passant
You are correct. I am getting an IntPtr and convert it to the interface object with Marshal.GetObjectForIUnknown method. This object can be subsequently cast to other interfaces, but not to the managed object implementing them
mfeingold