Class Interfaces Revisited

You always interact with a COM object through the interface(s) that it implements. A managed object, however, is not required to implement any interfaces. Therefore, when you use a managed object from an unmanaged client, one of the first questions you must ask yourself is what COM interface should you use to talk to the managed object? In Chapter 6, you learned that, by default, the CCW will expose a late-bound (IDispatch) interface through which you can call all of the public methods that the managed object exports. You can either use this IDispatch interface to call the managed object's methods (by running a QueryInterface for IID_IDispatch in Visual C++ or declaring your object variable to be of type object in Visual ...

Get .NET and COM Interoperability Handbook, The now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.