共用方式為


IDispatchImpl Class

This class provides a default implementation for IDispatch portion of a dual interface.

template<
   class T,
   const IID* piid= &__uuidof(T),
   const GUID* plibid = &CAtlModule::m_libid,
   WORD wMajor = 1,
   WORD wMinor = 0,
   class tihclass = CComTypeInfoHolder 
> 
class ATL_NO_VTABLE IDispatchImpl :
   public T

Parameters

  • T
    A dual interface.

  • piid
    A pointer to the IID of T.

  • plibid
    A pointer to the LIBID of the type library that contains information about the interface. By default, the server-level type library is passed.

  • wMajor
    The major version of the type library. The default value is 1.

  • wMinor
    The minor version of the type library. The default value is 0.

  • tihclass
    The class used to manage the type information for T. The default value is CComTypeInfoHolder.

Remarks

IDispatchImpl provides a default implementation for the IDispatch portion of any dual interface on your object. A dual interface derives from IDispatch and uses only Automation-compatible types. Like a dispinterface, a dual interface supports early and late binding; however, a dual interface differs in that it also supports vtable binding. For more information, see Implementing the IDispatch Interface.

The following example shows a typical implementation of IDispatchImpl:

class ATL_NO_VTABLE CBeeper :
   public CComObjectRootEx<CComSingleThreadModel>,
   public CComCoClass<CBeeper, &CLSID_Beeper>,
   public IDispatchImpl<IBeeper, &IID_IBeeper, &LIBID_NVC_ATL_COMLib, /*wMajor =*/ 1, /*wMinor =*/ 0>

IDispatchImpl contains a static member of type CComTypeInfoHolder that manages the type information for the dual interface. If you have multiple objects implementing the same dual interface, only a single instance of CComTypeInfoHolder will be used.

Requirements

Header: atlcom.h

See Also

Concepts

IDispatchImpl Members

ATL Class Overview