IDispatchImpl Class

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see IDispatchImpl Class on docs.microsoft.com. Provides a default implementation for the IDispatch part of a dual interface.

System_CAPS_ICON_important.jpg 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.

Public Constructors

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

Public Methods

NameDescription
IDispatchImpl::GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers.
IDispatchImpl::GetTypeInfoRetrieves the type information for the dual interface.
IDispatchImpl::GetTypeInfoCountDetermines whether there is type information available for the dual interface.
IDispatchImpl::InvokeProvides access to the methods and properties exposed by the dual interface.

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.

T

IDispatchImpl

Header: atlcom.h

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

STDMETHOD(GetIDsOfNames)(
    REFIID riid,
    LPOLESTR* rgszNames,
    UINT cNames,
    LCID lcid,
    DISPID* rgdispid);

Remarks

See IDispatch::GetIDsOfNames in the Windows SDK.

Retrieves the type information for the dual interface.

STDMETHOD(GetTypeInfo)(
    UINT itinfo,
    LCID lcid,
    ITypeInfo** pptinfo);

Remarks

See IDispatch::GetTypeInfo in the Windows SDK.

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

STDMETHOD(GetTypeInfoCount)(UINT* pctinfo);

Remarks

See IDispatch::GetTypeInfoCount in the Windows SDK.

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

IDispatchImpl();

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

STDMETHOD(Invoke)(
    DISPID dispidMember,
    REFIID riid,
    LCID lcid,
    WORD wFlags,
    DISPPARAMS* pdispparams,
    VARIANT* pvarResult,
    EXCEPINFO* pexcepinfo,
    UINT* puArgErr);

Remarks

See IDispatch::Invoke in the Windows SDK.

Class Overview

Show: