2010-08-19 52 views
0

看來我的程序沒有處理DownloadComplete事件。有人可以指導我,我做錯了嗎?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() 

回答

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

+0

感謝您的答覆傢伙。但我已經做到了。我可以知道,如果downloadcomplete沒有被IE調用,那麼可能出現的錯誤是什麼? – barlyee 2010-09-03 01:22:11