template< class T, const IID* piid, const GUID* plibid, WORD wMajor = 1,
WORD wMinor = 0, class tihclass = CComTypeInfoHolder >
class IDispatchImpl : public T
Parameters
T A dual interface.
piid A pointer to the IID of T.
plibid A pointer to the identifier of T's type library section.
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.
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.
The following example shows a typical implementation of IDispatchImpl:
class CBeeper : public IDispatchImpl< IBeeper, &IID_IBeeper, &LIBID_BeeperLib >, public CComObjectRoot, public CComCoClass< CBeeper, &CLSID_Beeper > { ... };
IDispatchImpl contains a static member of type CComTypeInfoHolder that manages the type information for the specified dual interface. If you have multiple objects implementing the same dual interface, only a single instance of CComTypeInfoHolder will be used.
#include <atlcom.h>
See Also IDispatch and ITypeInfo in the Win32 SDK
Class Methods | |
IDispatchImpl | Constructor. |
IDispatch Methods | |
GetIDsOfNames | Maps a set of names to a corresponding set of dispatch identifiers. |
GetTypeInfo | Retrieves the type information for the dual interface. |
GetTypeInfoCount | Determines whether there is type information available for the dual interface. |
Invoke | Provides access to the methods and properties exposed by the dual interface. |
Data Members | |
_tih | Manages the type information for the dual interface. |
HRESULT GetIDsOfNames( REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid );
See IDispatch::GetIDsOfNames in the Win32 SDK.
Remarks
Maps a set of names to a corresponding set of dispatch identifiers.
IDispatchImpl Overview | Class Members
HRESULT GetTypeInfo( UINT itinfo, LCID lcid, ITypeInfo** pptinfo );
See IDispatch::GetTypeInfo in the Win32 SDK.
Remarks
Retrieves the type information for the dual interface.
IDispatchImpl Overview | Class Members
See Also IDispatchImpl::GetTypeInfoCount
HRESULT GetTypeInfoCount( UINT* pctinfo );
See IDispatch::GetTypeInfoCount in the Win32 SDK.
Remarks
Determines whether there is type information available for the dual interface.
IDispatchImpl Overview | Class Members
See Also IDispatchImpl::GetTypeInfo
IDispatchImpl( );
Remarks
The constructor. Calls AddRef on the _tih member. The destructor calls Release.
IDispatchImpl Overview | Class Members
HRESULT Invoke( DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr );
See IDispatch::Invoke in the Win32 SDK.
Remarks
Provides access to the methods and properties exposed by the dual interface.
IDispatchImpl Overview | Class Members
static tihclass _tih;
Remarks
This static data member is an instance of the class template parameter, tihclass, which by default is CComTypeInfoHolder. _tih manages the type information for the dual interface.