佚名通过本文主要向大家介绍了神途开服表单职业,麦客表单,表单大师,用友表单,麦克表单等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 初学提交表单,请教这里的达人?
描述:
该函数的功能是,把程序中编辑框的文字放到百度首页的编辑框中。
奢求达人帮我一一解释第五行以后的语句,
解决方案1:
百度首页的那个编辑框的name就是“wd”,值为0
所以spElementCollection->item(CComVariant("wd"), CComVariant("0"), &spDisp);
就是枚举百度的name为"wd", value为"0"的元素,并在下一步给其赋值
描述:
本帖最后由 VisualEleven 于 2012-01-09 15:13:26 编辑
void CChangeHtmlByMFCDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
CString str;
GetDlgItem(IDC_EDIT)->GetWindowText(str); //得到编辑框的字符串,放到百度输入框中
CComPtr < IDispatch > spDispDoc;
spDispDoc = m_WebOcx.get_Document();
CComQIPtr< IHTMLDocument2 > spDocument2 = spDispDoc;
CComQIPtr< IHTMLElementCollection > spElementCollection;
// HRESULT hr = spDocument2->get_forms( &spElementCollection );
if(SUCCEEDED(spDocument2->get_all(&spElementCollection)))
{
CComPtr<IDispatch> spDisp;
HRESULT hr;
hr = spElementCollection->item(CComVariant("wd"), CComVariant("0"), &spDisp);
if(SUCCEEDED(hr))
{
CComQIPtr<IHTMLInputElement> spElem = spDisp;
spElem->put_value(CComBSTR(str));
}
}
}
该函数的功能是,把程序中编辑框的文字放到百度首页的编辑框中。
奢求达人帮我一一解释第五行以后的语句,
解决方案1:
百度首页的那个编辑框的name就是“wd”,值为0
所以spElementCollection->item(CComVariant("wd"), CComVariant("0"), &spDisp);
就是枚举百度的name为"wd", value为"0"的元素,并在下一步给其赋值