Browser - IWebBrowser2
Document - IHTMLDocument2
Frame/IFrame - IHTMLWindow2
Element - IHTMLElement
可以通过下面方法互相获取:
browser -> document IWebBrowser2::get_Document
document -> frame IHTMLDocument2::get_parentWindow
frame -> document IHTMLWindow2::get_document
frame -> parent frame IHTMLWindow2::get_parent
frame -> children frames IHTMLWindow2::get_frames
element -> Frame IHTMLElement->QI(IHTMLFrameBase2) -> IHTMLFrameBase2->get_contentWindow -> IHTMLWindow2
调用方法参考下例:
CComQIPtr<IHTMLWindow2> spHtmlWin;
CComQIPtr<IHTMLDocument2> spHtmlDoc;
spHtmlWin->get_document(&spHtmlDoc);