MFC 怎么执行网页的javascript脚本
答案:1 悬赏:60
解决时间 2021-02-17 06:29
- 提问者网友:聂風
- 2021-02-16 23:09
MFC 怎么执行网页的javascript脚本
最佳答案
- 二级知识专家网友:春色三分
- 2021-02-17 00:20
C/C++ codeIHTMLDocument2 *pHTMLDocument=NULL;
if (!(pHTMLDocument = (IHTMLDocument2*)m_browser.get_Document())) //获取 IHTMLDocument2 的接口指针
return;
CString sScript = "__doPostBack(\'lbNextPage\',\'\')";//设置要调用的javascript函数
CString Type = "javascript";//设置调用的脚本类型
IHTMLWindow2 *m_pHtmlWindow=NULL;
pHTMLDocument->get_parentWindow(&m_pHtmlWindow);//得到子框架
VARIANT ret;
ret.vt = VT_EMPTY;
BSTR bstr = sScript.AllocSysString();
BSTR btype = Type.AllocSysString ();
m_pHtmlWindow->execScript(bstr,btype , &ret);//执行要调用的脚本函数。
::SysFreeString(bstr);
::SysFreeString(btype);
if (!(pHTMLDocument = (IHTMLDocument2*)m_browser.get_Document())) //获取 IHTMLDocument2 的接口指针
return;
CString sScript = "__doPostBack(\'lbNextPage\',\'\')";//设置要调用的javascript函数
CString Type = "javascript";//设置调用的脚本类型
IHTMLWindow2 *m_pHtmlWindow=NULL;
pHTMLDocument->get_parentWindow(&m_pHtmlWindow);//得到子框架
VARIANT ret;
ret.vt = VT_EMPTY;
BSTR bstr = sScript.AllocSysString();
BSTR btype = Type.AllocSysString ();
m_pHtmlWindow->execScript(bstr,btype , &ret);//执行要调用的脚本函数。
::SysFreeString(bstr);
::SysFreeString(btype);
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯