1.在CHtmlView中已经得到了网页的内容IHTMLDocument2*pDOC
2.分析pDOC已经得到了CComQIPtr< IHTMLElementCollection > spElementCollection表单
3.同时CComDispatchDriver spInputElement;得到了表单域
4.通过以下方式得到了表单的名称\类型和参数CComDispatchDriver spInputElement; //取得第 j 项表单域
hr = spFormElement->item( CComVariant( j ), CComVariant(), &spInputElement );
if ( FAILED( hr ) ) continue;CComVariant vName,vVal,vType; //取得表单域的 名,值,类型
hr = spInputElement.GetPropertyByName( L"name", &vName );
if( FAILED( hr ) ) continue;
hr = spInputElement.GetPropertyByName( L"value", &vVal );
if( FAILED( hr ) ) continue;
hr = spInputElement.GetPropertyByName( L"type", &vType );
if( FAILED( hr ) ) continue;LPCTSTR lpName = vName.bstrVal?
OLE2CT( vName.bstrVal ) : _T("NULL"); //未知域名
LPCTSTR lpVal = vVal.bstrVal?
OLE2CT( vVal.bstrVal ) : _T("NULL"); //空值,未输入
LPCTSTR lpType = vType.bstrVal?
OLE2CT( vType.bstrVal ) : _T("NULL"); //未知类型strName = (LPSTR)lpName;
strType = (LPSTR)lpType;
strValue = (LPSTR)lpVal;问题:
1.如何对表单的参数赋值
2.如何提交表单并显示提交后网页的内容
2.分析pDOC已经得到了CComQIPtr< IHTMLElementCollection > spElementCollection表单
3.同时CComDispatchDriver spInputElement;得到了表单域
4.通过以下方式得到了表单的名称\类型和参数CComDispatchDriver spInputElement; //取得第 j 项表单域
hr = spFormElement->item( CComVariant( j ), CComVariant(), &spInputElement );
if ( FAILED( hr ) ) continue;CComVariant vName,vVal,vType; //取得表单域的 名,值,类型
hr = spInputElement.GetPropertyByName( L"name", &vName );
if( FAILED( hr ) ) continue;
hr = spInputElement.GetPropertyByName( L"value", &vVal );
if( FAILED( hr ) ) continue;
hr = spInputElement.GetPropertyByName( L"type", &vType );
if( FAILED( hr ) ) continue;LPCTSTR lpName = vName.bstrVal?
OLE2CT( vName.bstrVal ) : _T("NULL"); //未知域名
LPCTSTR lpVal = vVal.bstrVal?
OLE2CT( vVal.bstrVal ) : _T("NULL"); //空值,未输入
LPCTSTR lpType = vType.bstrVal?
OLE2CT( vType.bstrVal ) : _T("NULL"); //未知类型strName = (LPSTR)lpName;
strType = (LPSTR)lpType;
strValue = (LPSTR)lpVal;问题:
1.如何对表单的参数赋值
2.如何提交表单并显示提交后网页的内容
解决方案 »
- 求界面层次问题
- 屏幕上如何画大于1024个点组成的曲线?
- 采用gdi+ 把jpeg流转换成24位bmp流的问题
- 小弟现在遇到一个问题很急,因为2号就是后天我们要教了!所以在这个上面发个帖子问问大家!
- 2005中 CString转化为string的问题
- afxcallwndproc afxwndproc 这样的函数 msdn中怎么没有呢?
- 对话框中CStatic的Create问题
- 出现了两个不名的线程..........大家帮帮我.
- 放假回家想做一个数据库系统,不知道做什么,大家可不可以给点建议?
- VC中 某个窗口做焦点的问题
- Date Time Picker时间控件只能显示日期或时分秒,我怎么才能让它在界面上同时显示出两者,并且保证点击下拉按钮时可编辑日期?
- 回调函数怎么调用对象的函数?
2、spFormElement->submit();
error C2039: 'PutValue' : is not a member of 'IDispatch'
see declaration of 'IDispatch'
CComVariant Value(L"password");
spInputElement.PutPropertyByName(L"value",&Value);