初学提交表单,请教这里的达人?
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)); } }}