首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

初学提交表单,请问这里的达人

2012-04-28 
初学提交表单,请教这里的达人?C/C++ codevoid CChangeHtmlByMFCDlg::OnBnClickedButton2(){// TODO: 在此

初学提交表单,请教这里的达人?

C/C++ code
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));        }    }}


该函数的功能是,把程序中编辑框的文字放到百度首页的编辑框中。

奢求达人帮我一一解释第五行以后的语句,

[解决办法]
探讨

引用:
获取所有的HTML页面元素,然后匹配关键字得到对应的元素,然后设置数据


老师,大概的意思我理解,

spElementCollection->item(CComVariant("wd"), CComVariant("0"), &amp;spDisp);

这句里面的CComVariant("wd"), CComVariant("0")……

热点排行