VC向网页注入脚本

2014-11-23 21:30:21 · 作者: · 浏览: 94


IHTMLDocument2 *pDoc2

......

IHTMLWindow2 *pWindow;
HRESULT hr=pDoc2->get_parentWindow(&pWindow);
VARIANT ret;
ret.vt=VT_EMPTY;
CComBSTR func="alert(document.cookie)";
CComBSTR lang="java script";
hr=pWindow->execScript(func,lang,&ret);