初学提交表单,请教这里的达人?
- 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)); } }}
该函数的功能是,把程序中编辑框的文字放到百度首页的编辑框中。
奢求达人帮我一一解释第五行以后的语句,
[解决办法]