mfc 调用网页中的JS !!
程序漫步 2013-03-21 06:24:14 IHTMLDocument2* pDocument;
//获得 html 的 Document 节点
HRESULT hr =m_Html.GetDHtmlDocument(&pDocument);
IHTMLWindow2* pWindow;
//获得 Document 的窗口节点
pDocument->get_parentWindow(&pWindow);
VARIANT ret;
ret.vt = VT_EMPTY;
pWindow->execScript(L"refreshFlash()",L"JavaScript",&ret);
//清理工作,释放 Document 和 window节点
pDocument->Release();
pWindow->Release();
以上市我的方法!!!
但是 GetDHtmlDocument 获得总是为空啊????
求助下。。如何调用JS啊。。网上的 都尝试了 好像不行 !!
我继承的 是 CDHtmlDialog
好像是不是要调用下 OnDocumentComplete; 但我实现OnDocumentComplete 系统不调用啊!!!!!
void CHtmlDL::OnDocumentComplete(LPDISPATCH pDisp, VARIANT* URL)
{
//不调用!!!
}