佚名通过本文主要向大家介绍了mfc浏览器,基于mfc的图片浏览器,mfc 浏览器控件,谷歌浏览器mfc,mfc操作excel等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 关于MFC操作浏览器
描述:
<A id=submitaid href="javascript:mySubmit();"><IMG border=0 src=""></A>
例如上面这样的一句话,我怎么通过点击MFC中的按钮提交这个JSP中的超链接。
mfc中我可以采用CHtmlView和ActiveX控件中的web控件
谢谢
解决方案1:
描述:
CHtmlViewmfcactivex浏览器
我先谢谢各位高手前来解答。<A id=submitaid href="javascript:mySubmit();"><IMG border=0 src=""></A>
例如上面这样的一句话,我怎么通过点击MFC中的按钮提交这个JSP中的超链接。
mfc中我可以采用CHtmlView和ActiveX控件中的web控件
谢谢
解决方案1:
我试了有这个方式在其他网站可以但是,工行这种银行网站不行
CString allPointData;
IDispatch *pDisp = m_webBrower.get_Document();
IHTMLDocument2* pDocument;
IHTMLElementCollection* pCollection;
pDisp->QueryInterface(IID_IHTMLDocument2, (void**)&pDocument);
HRESULT hr;
hr = pDocument->get_all(&pCollection);
if (hr == S_OK)
{
long celem;
hr = pCollection->get_length(&celem); //得到所有节点的个数用以遍历
if (hr == S_OK)
{
VARIANT varIndex, var;
for (int i = 0; i < celem; i++)
{
varIndex.vt = VT_UINT;
varIndex.lVal = i;
VariantInit(&var);
hr = pCollection->item(varIndex, var, &pDisp);
if (hr == S_OK)
{
IHTMLElement *pElement;
hr = pDisp->QueryInterface(IID_IHTMLElement, (void**)&pElement);
if (hr == S_OK)
{
CString pointData, id;
BSTR bs;
pElement->get_id(&bs);
id = CString(bs);
if (id == _T("sb_form_q"))
{
IHTMLInputElement* input;
hr = pDisp->QueryInterface(IID_IHTMLInputElement, (void**)&input);
input->get_value(&bs); //将id为LanLonPoints中的value值赋给bs
pointData = CString(bs);
allPointData = pointData;
}
if (id==_T("submitaid"))
{
IHTMLInputElement* Output;
hr = pDisp->QueryInterface(IID_IHTMLInputElement, (void**)&Output);
Output->put_checked(TRUE);
//Output->get_value(&bs); //将id为LanLonPoints中的value值赋给bs
//pointData = CString(bs);
//allPointData = pointData;
}
}
}
}
}
}