IDispatch and IDocHostUIHandlerDispatch : two IDispatchImpl bases

From: Ram Shriram (rawdata_at_nospam.com)
Date: 02/29/04


Date: Sat, 28 Feb 2004 22:33:31 -0800

In my band object having a CAxWindow hosting a webbrowser control, I am
implementing IDispatch to listen to WebBrowser events.

In addition, I now want to implement IDocHostUIHandlerDispatch using the
steps from KB 274202 (
http://support.microsoft.com/default.aspx?scid=kb;en-us;274202 ) so now my
class declaration looks like:

class ATL_NO_VTABLE CMyBandObj :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IMyBandObj, &IID_IMyBandObj, &LIBID_MYBANDLib>,
public IDispatchImpl<IDocHostUIHandlerDispatch,
&IID_IDocHostUIHandlerDispatch, &LIBID_ATLLib>, // << ADDED NOW
...
{
public:
BEGIN_COM_MAP(CMyBandObj)

COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IDocHostUIHandlerDispatch) // << ADDED NOW
...
END_COM_MAP()

As IDispatch gets implemented in two places using IDispatchImpl, I get the
following error on compilation:
error C2594: 'static_cast' : ambiguous conversions from
'CMyBandObj::_ComMapClass *' to 'IDispatch *'

How can I overcome this problem ? Do I need to move the original IDispatch
implementation to a new ATL object?

Thanks for your help,
RS



Relevant Pages