tags:

views:

50

answers:

1

It seems that my program does not handle the DownloadComplete event. Can someone guide me where I did wrong?

class ATL_NO_VTABLE CStockBar : 
  public CComObjectRootEx<CComSingleThreadModel>,
  public CComCoClass<CStockBar, &CLSID_StockBar>,
  public IDeskBand,
  //public IObjectWithSite,
  public IObjectWithSiteImpl<CStockBar>,
  public IInputObject, 
  public IDispatchImpl<IStockBar, &IID_IStockBar, &LIBID_MOTLEYFOOLLib, 1, 0>,
  public IDispEventImpl<1, CStockBar, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1>


  BEGIN_COM_MAP(CStockBar)
    COM_INTERFACE_ENTRY(IStockBar)
    COM_INTERFACE_ENTRY(IInputObject)
    COM_INTERFACE_ENTRY(IOleWindow)
    COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
    COM_INTERFACE_ENTRY(IObjectWithSite)
    COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
    COM_INTERFACE_ENTRY(IDispatch)
  END_COM_MAP()


  BEGIN_SINK_MAP(CStockBar)
     SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete)
  END_SINK_MAP()
A: 
BEGIN_SINK_MAP(CStockBar)
   SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete)
END_SINK_MAP()

Just add the following in the above:

SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete)

http://msdn.microsoft.com/en-us/library/cc136548%28v=VS.85%29.aspx

Favonius
Thanks for the reply dude. But I have done that. May I know what is the possible mistake if the downloadcomplete is not call by the IE?
barlyee