我用Ole的方式打开了Internet Explorer,请问我如何得到文档已经下载完毕的消息?

解决方案 »

  1.   

    再请教一下行吗?我是在VC下面用CreateInstance打开的IE,返回的是IWebBrowser2接口,我好像没有直接用到CHtmlView,该怎么办呢?谢过了!
      

  2.   

    MSDN Home >  MSDN Web & Internet Samples > Component Development
    Objvw sample 
     
    HRESULT CObjVw::SetClientSite(IOleClientSite *pClientSite)
    {
    HRESULT hr = S_OK; if(NULL != pClientSite)
    {
    ATLTRACE(_T("SetClientSite called\n")); m_spClientSite = pClientSite;  // This AddRefs the client site
       // if null, existing client site is released
    }
    else
    {
    //REMOVE: _ASSERT(0 != m_dwAdviseCookie);
    _ASSERT(m_spWebBrowser != NULL); ATLTRACE(_T("SetClientSite NULL called\n")); //REMOVE: hr = AtlUnadvise( m_spWebBrowser, __uuidof(SHDocVw::DWebBrowserEvents2), m_dwAdviseCookie );

    IDispEventImpl<0, CObjVw, &__uuidof(SHDocVw::DWebBrowserEvents2),
    &LIBID_OBJVWLib, 1, 0>::DispEventUnadvise(m_spWebBrowser);

    m_spWebBrowser.Release(); return S_OK;
    }

    try
    {
    IServiceProviderPtr spSP((LPOLECLIENTSITE)m_spClientSite); if(NULL == spSP)
    return hr; spSP->QueryService(__uuidof(SHDocVw::IWebBrowserApp), 
    __uuidof(SHDocVw::IWebBrowser2), (void**)&m_spWebBrowser); //REMOVE: hr = AtlAdvise(m_spWebBrowser, GetControllingUnknown(), __uuidof(SHDocVw::DWebBrowserEvents2), &m_dwAdviseCookie);

    IDispEventImpl<0, CObjVw, &__uuidof(SHDocVw::DWebBrowserEvents2),
        &LIBID_OBJVWLib, 1, 0>::DispEventAdvise(m_spWebBrowser); }
    catch(...)
    {
    return S_FALSE;
    } return hr;
    }
      

  3.   

    我明白了,太谢谢你了!你真牛!Thanks Again!