Udostępnij za pośrednictwem


IDispatchImpl Class

Provides a default implementation for the IDispatch part 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

  • [in] T
    A dual interface.

  • [in] piid
    A pointer to the IID of T.

  • [in] 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.

  • [in] wMajor
    The major version of the type library. By default, the value is 1.

  • [in] wMinor
    The minor version of the type library. By default, the value is 0.

  • [in] tihclass
    The class used to manage the type information for T. By default, the value is CComTypeInfoHolder.

Remarks

IDispatchImpl provides a default implementation for the IDispatch part of any dual interface on an object. A dual interface derives from IDispatch and uses only Automation-compatible types. Like a dispinterface, a dual interface supports early binding and late binding; however, a dual interface also supports vtable binding.

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>

By default, the IDispatchImpl class looks up the type information for T in the registry. To implement an unregistered interface, you can use the IDispatchImpl class without accessing the registry by using a predefined version number. If you create an IDispatchImpl object that has 0xFFFF as the value for wMajor and 0xFFFF as the value for wMinor, the IDispatchImpl class retrieves the type library from the .dll file instead of the registry.

IDispatchImpl contains a static member of type CComTypeInfoHolder that manages the type information for the dual interface. If you have multiple objects that implement the same dual interface, only one instance of CComTypeInfoHolder is used.

Requirements

Header: atlcom.h

See Also

Other Resources

IDispatchImpl Members

ATL Class Overview

Change History

Date

History

Reason

Added information for creating an unregistered interface.

Information enhancement.