IDispatchImpl Class

Provides a default implementation for the IDispatch part of a dual interface.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

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.

Members

Public Constructors

Name

Description

IDispatchImpl::IDispatchImpl

The constructor. Calls AddRef on the protected member variable that manages the type information for the dual interface. The destructor calls Release.

Public Methods

Name

Description

IDispatchImpl::GetIDsOfNames

Maps a set of names to a corresponding set of dispatch identifiers.

IDispatchImpl::GetTypeInfo

Retrieves the type information for the dual interface.

IDispatchImpl::GetTypeInfoCount

Determines whether there is type information available for the dual interface.

IDispatchImpl::Invoke

Provides access to the methods and properties exposed by the dual interface.

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.

Inheritance Hierarchy

T

IDispatchImpl

Requirements

Header: atlcom.h

See Also

Other Resources

ATL Class Overview