VC自动提交表单????

Fikhtengoli 2011-05-28 10:23:58
我想自动登录这个http://222.194.15.1:7777/zhxt_bks/zhxt_bks.html怎么写
...全文
654 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yym_1990 2011-06-17
  • 打赏
  • 举报
回复
谢谢,有帮助
yym_1990 2011-06-17
  • 打赏
  • 举报
回复
顶一下,很不错
dandanxiyu 2011-06-12
  • 打赏
  • 举报
回复
http://support.microsoft.com/kb/q167658/
如何自动 Internet Explorer POST 表单数据
vcf_reader 2011-06-04
  • 打赏
  • 举报
回复
Navigate2("http://222.194.15.1:7777/zhxt_bks/zhxt_bks.html")
coolzdp 2011-06-02
  • 打赏
  • 举报
回复
http://www.codeproject.com/KB/IP/CppHttpWebForm.aspx
wildwise 2011-05-30
  • 打赏
  • 举报
回复
我前段时间刚好做过,这段是完整的了,能够满足你的要求,我的已经在用了。
wildwise 2011-05-30
  • 打赏
  • 举报
回复
VOID CDlgIEDlg::AutoFillForm(IHTMLDocument2 *pIHTMLDocument2,CComVariant userID,CComVariant password)
{

if( !pIHTMLDocument2 )return;

HRESULT hr;
CComBSTR bstrTitle;
pIHTMLDocument2->get_title( &bstrTitle );//取得文档标题

CComQIPtr< IHTMLElementCollection > spElementCollection;
hr = pIHTMLDocument2->get_forms( &spElementCollection );//取得表单集合
if ( FAILED( hr ) )
{
AfxMessageBox("获取表单的集合 IHTMLElementCollection 错误");
return;
}
long nFormCount=0;//取得表单数目
hr = spElementCollection->get_length( &nFormCount );
if ( FAILED( hr ) )
{
AfxMessageBox("获取表单数目错误");
return;
}

for(long i=0; i<nFormCount; i++)
{
IDispatch *pDisp = NULL;//取得第 i 项表单
hr = spElementCollection->item( CComVariant( i ), CComVariant(), &pDisp );
if ( FAILED( hr ) )continue;

CComQIPtr< IHTMLFormElement > spFormElement = pDisp;
pDisp->Release();

long nElemCount=0;//取得表单中 域 的数目
hr = spFormElement->get_length( &nElemCount );
if ( FAILED( hr ) )continue;

for(long j=0; j<nElemCount; j++)
{
CComDispatchDriver spInputElement;//取得第 j 项表单域
CComVariant vName,vVal,vType;//取得表单域的名,值,类型
hr = spFormElement->item( CComVariant( j ), CComVariant(), &spInputElement );
if ( FAILED( hr ) )continue;
hr = spInputElement.GetPropertyByName(L"name", &vName);
if(vName == (CComVariant)"userID")
{
vVal = userID;
spInputElement.PutPropertyByName(L"value",&vVal);
}
if(vName == (CComVariant)"password")
{
vVal = password;
spInputElement.PutPropertyByName(L"value",&vVal);
}
}
spFormElement->submit();
}
}
mfc168 2011-05-30
  • 打赏
  • 举报
回复
CInternetSession mSession;
mSession.OpenURL("http://222.194.15.1:7777/zhxt_bks/zhxt_bks.html");
MoXiaoRab 2011-05-30
  • 打赏
  • 举报
回复
IHtmlDocument2 接口
获得IHTMLFormElement,然后spFormElement->submit();
Fikhtengoli 2011-05-30
  • 打赏
  • 举报
回复
求帮助
cngst 2011-05-28
  • 打赏
  • 举报
回复
http协议内容部分,body=表单的值,提交给服务器

3,055

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC HTML/XML
社区管理员
  • HTML/XML社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧