BHO没有调用DownloadComplete事件

时间:2010-08-19 06:35:09

标签: visual-c++ bho

似乎我的程序没有处理DownloadComplete事件。有人可以指导我做错的地方吗?

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()

1 个答案:

答案 0 :(得分:0)

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

只需在上面添加以下内容:

SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOWNLOADCOMPLETE, OnDownloadComplete)

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