Re: Dual interface

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi George,

Sorry for asking this simple question. I found after some coding, I
have some new understanding of the concept. Now I think dual
interface means the com object inherits from IDispatch, and since
IDispatch inherits from IUnknown, the COM consumer could choose to
use IDispatch or IUnknown, so called dual interface.

For non-dual interface, I think it means the com object only
implements interface IUnknown.

My understandings are both correct?

No, dual interfaces mean that you have your own custom
interface which derives from IDispatch. So your component
exposes IUnknown, IDispatch and your custom interface.
Your components functions can be called "directly" with your
custom interface or "indirectly" through IDispatch::Invoke.

This gives e.g. the advantage that your component is usable
in scripting languages which rely on IDispatch as well as in
more capable languages like C++ which know how to deal
with custom interfaces.

--
SvenC
.



Relevant Pages

  • IDispatch* , COM Server(LOCAL_SERVER), event data and C#.NET
    ... I have one main inbound interface called ... If IDispatch is the answer, I already did the following, ... I did code following C++ wrapper class for the _ICallInfo impl. ... // object before calling the base class. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Problems with IDispatchImpl
    ... you have your own dual interface defined in another type library. ... You have to check if this IApplication is indeed a dual interface. ... IDispatch by hand (based on your previous post, ... > The IDispatch methods are indeed implemented by IDispatchImpl, ...
    (microsoft.public.vc.atl)
  • Re: Crash on 4th call to ATL exe server from VB
    ... simply checks whether two pointers are identical. ... Imagine that the type is IUnknown. ... to IDispatch in the presence of marshaling: ... IDispatch and one for the dual interface. ...
    (microsoft.public.vc.atl)
  • Re: Dual interface
    ... If a component implements IDispatch directly, ... IUnknown, so every COM object had QueryInterface/AddRef/Release. ... interface implements IUnknown, then we could invoke the component's member ... vtable in the customized interface to invoke member methods. ...
    (microsoft.public.vc.language)
  • Re: Problems with IDispatchImpl
    ... you have your own dual interface defined in another type library. ... You have to check if this IApplication is indeed a dual interface. ... IDispatch by hand (based on your previous post, ... > The IDispatch methods are indeed implemented by IDispatchImpl, ...
    (microsoft.public.vc.atl)