IHTMLDocument2 TO IWebBrowser2

if(NULL != pIHTMLDocument2)
{
IHTMLWindow2* pIHTMLWindow2 = NULL;
hr = pIHTMLDocument2->get_parentWindow(&pIHTMLWindow2);
if((S_OK == hr) && (NULL != pIHTMLWindow2))
{
IServiceProvider* pISP = NULL;
hr = pIHTMLWindow2->QueryInterface(IID_IServiceProvider, (void**)& pISP);
if((S_OK == hr) && (NULL != pISP))
{
IWebBrowser2* pIWebBrowser2 = NULL;
hr = pISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)& pIWebBrowser2);
if((S_OK == hr) && (NULL != pIWebBrowser2))
{
//…
}
pISP->Release();
}
pIHTMLWindow2->Release();
}
}

posted @ 2014-04-04 16:54  荷包蛋  阅读(612)  评论(0编辑  收藏  举报