利用IWebBrowser2的IWebBrowser2::get_Document得doc对象

 two   way   to   get   HTML   interfaces  
  1   call   CWnd::GetControlUnknown   to   get   IWebbrowser2   Interface  
  LPUNKNOWN   lpUnk   =   m_wndBrowser.GetControlUnknown();  
  HRESULT   hr   =   lpUnk->QueryInterface(IID_IWebBrowser2,   (void**)   &m_pBrowserApp);  
   
  2   call   CHtmlView::GetHtmlDocument()   or   CWebBrowser2::GetDocument()  
  LPDISPATCH   lpDisp   =   m_wndBrowser.GetDocument();  
  HRESULT   hr   =   lpDisp->QueryInterface(IID_IHTMLDocument2,   (void**)   &m_phtmlDoc);  
   
  note:objects   which   support   IHTMLDocument2   may   or   may   not   support   other   interfaces,such   as   IHTMLDocument5   ,ICustomDoc     or   IXMLDOMDocument.

你可能感兴趣的:(MFC使用技巧)