用的是WinInet  以www.126.com为例:中间的JS省略掉了<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>126网易免费邮--你的专业电子邮局</title>
<meta content="中文专业免费邮箱,邮箱伴侣,随身邮,邮箱贺卡,自写短信,免费网易网盘,网络硬盘,网络记事本,rss阅读,Free Email" name="keywords">
<meta content="网易126邮箱--专业电子邮局提供免费网络硬盘网络硬盘.126网易免费邮是网易公司顷力打造的专业电子邮局,3G免费空间,支持超大20兆附件。126邮箱使用创新Ajax技术, 同等网络环境下,页面响应时间减少90%以上,垃圾邮件及病毒有效拦截率超过98%和99.8%。" name="description">
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<link rel="shortcut icon" href="http://www.126.com/favicon.ico" />
<link href="http://mimg.126.com/index/style_index_080718.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.Speed_add{position:absolute; left:-50px;top:261px;width:205px;height:20px;line-height:20px;text-align:right;z-index:999}
</style>      </div>
      <form method="post" action="http://entry.126.com/cgi/login" name="form" onSubmit="return fCheck()">
        <input name="domain" type="hidden" value="126.com" />
        <input name="language" type="hidden" value="0" />
        <input name="bCookie" type="hidden" value="" />
        <input name="username" type="hidden" value="" />
        <div class="ge" style="height:9px"></div>
        <p class="MR_pinp"><span>用户名</span>
          <input type="text" name="user" onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onBlur="fEvent('blur',this)" onMouseOut="fEvent('mouseout',this)" maxlength="20" tabindex="1"/>          <b class="m126" title="@126.com"></b></p>
        <div class="ge"></div>
        <p class="MR_pinp LH"><span>密 码</span>
          <input onMouseOver="fEvent('mouseover',this)" onFocus="fEvent('focus',this)" onBlur="fEvent('blur',this)" onMouseOut="fEvent('mouseout',this)" name="password" type="password" size="16" tabindex="2"  maxlength="20"/>
          <a href="http://reg.163.com/RecoverPasswd1.shtml" target="_blank" style="margin-top:7px">忘记密码了?</a></p>
        <div class="ge"></div>
        <p class="MR_pinp LH"><span>版 本</span>          <select name="style" id="login_select">
            <option value="-1" selected="selected">   默   认   </option>
            <option value="23">   逍遥 3.0   </option>
            <option value="21">   极速 3.0   </option>
            <option value="3">   简约 3.0   </option>    
          </select>
          <!-- <a href="http://uinfo.mail.126.com/xy3/index.htm" target="_blank" class="sj_a">升级逍遥3.0</a> -->
        </p>
        <div class="ge"></div>
        <p class="MR_check" style="margin-top:14px"><span class="wy"> </span>
          <input type="checkbox" value="" name="remUser" checked="checked" id="rem_U"style="vertical-align:middle;" />
          <label for="rem_U">在此电脑上记住用户名</label>        </p>
        <p class="MR_check LH2"><span class="wy"> </span>
          <input type="checkbox" value="" name="secure" id="secure" checked="checked" style="vertical-align:middle;" />
          <label for="secure">SSL安全登录</label>
          <a href="http://help.163.com/08/1111/16/4QG0DVBL00752CTH.html" target="_blank"><img style="display:inline; margin-top:-2px; vertical-align:middle" src="http://mimg.126.com/index/whyssl_126.gif" alt="什么是SSL登录" title="什么是SSL登录" />
          </a>
        </p>
        <div class="ge"></div>
        <p class="MR_But" style="margin-top:8px"><span class="wy"> </span>          <input type="submit" value="登 录" class="inp_L1" onMouseOver="this.className='inp_L2'" onMouseOut="this.className='inp_L1'" id="input_btn1"  name="enter.x" tabindex="4" onClick="setCookie('ntes_mail_firstpage','normal');saveLoginType();" />
          <input type="submit" value="登录网盘" class="inp_L1" onMouseOver="this.className='inp_L2'"  onMouseOut="this.className='inp_L1'" id="input_btn2"  tabindex="4" onClick="setCookie('ntes_mail_firstpage','normal');saveLoginType();" style="display:none"/>
        </p>
        <script>fInitUser();fSetLogType();fVoidIE5();</script>
      </form>
    </div>
  </div>
</div>
<!--最新消息--><div id="UN">
  <div id="News">
    <div id="News_TL"></div>
    <div id="News_Tt"><a href="http://kefu.mail.126.com/" target="_blank">最新动态</a></div>
    <div id="News_Tr"></div>
    <!--消息内容-->
    <div id="News_Cc">
      <ul>
      <li style="width:200px"><a href="http://pro.163.com/event.ng/Type=click&FlightID=139240&AdID=141080&TargetID=953&Values=31,43,51,60,72,84,100,110,150,312,316,330,332,457,568,588,702,733,734,774,788,942,943,944,948,949,950,951,1006,1123,1130,1131,1135&Redirect=http://cnt.zhaopin.com/Market/whole_counter.jsp%3Fsid%3D121111284%26site%3D126youxiangshouyeTL%26url%3Dhttp://images.zhaopin.com/zhaopin/denglu/index.html" target="_blank" >快点!新年新Job,好工作属于你</a>
</li>
      <li style="width:230px"><a href="http://tools.mail.163.com/sdy/" target="_blank" style="">下载网易首个邮箱客户端:“闪电邮” </a>      </li>
        
        <li style="width:200px"><a href="http://love.mail.163.com/valentine/main.do" target="_blank">免费送你和爱人去新加坡过情人节
 </a></li>
      </ul>
       <!-- <a href="http://kefu.mail.126.com/" target="_blank" class="fcopy">>></a>  -->
     </div>    <div id="News_Cr"></div>
  </div>
  <!--底部区域-->
  <div id="Footer"><a href="http://corp.163.com/index_gb.html" target="_blank">关于网易</a>&nbsp;&nbsp;<a href="http://mail.blog.163.com/" target="_blank">邮箱官方博客</a>&nbsp;&nbsp;<a href="http://www.188.com/index.htm?from=126mail" target="_blank">财富邮</a>&nbsp;&nbsp;<a href="http://appsms.mail.126.com/mailmms/smsnotify/reg_out.jsp?id=indexbottom" target="_blank">随身邮</a>&nbsp;&nbsp;<a href="http://www.126.com/help/mscan_01.htm" target="_blank">邮箱伴侣</a>&nbsp;&nbsp;<a href="http://cards.163.com/" target="_blank">精美贺卡</a>&nbsp;&nbsp;<a href="http://safesurf.china.cn/data_form.php" target="_blank">举报违法信息</a>&nbsp;&nbsp;<a href="http://help.163.com" target="_blank">客户服务</a><br />
    <a href="http://corp.163.com/gb/legal/legal.html" target="_blank">相关法律</a> | 网易公司版权所有 <span class="fcopy">&copy; </span>1997-2009</div></div>
<!--网络统计start-->
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="ReqCol" width="0" height="0" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" style="height:0;width:0">
            <param name="movie" value="ReqCol.swf" />
            <param name="FlashVars" value="requestURL=http://www.yeah.net/favicon.ico&submitURL=http://220.181.28.120/result.html"/>
            <param name="quality" value="high" />
            <param name="bgcolor" value="#869ca7" />
            <param name="allowScriptAccess" value="always" />
            <embed src="ReqCol.swf" FlashVars="requestURL=http://www.yeah.net/favicon.ico&submitURL=http://220.181.28.120/result.html" quality="high" bgcolor="#869ca7" width="0" height="0" name="ReqCol" align="middle" play="true" loop="false" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">
            </embed>
    </object>
<!--网络统计end-->
</body>
<script language="JavaScript">
<!--
function setCookie(name, value, isForever) {
    document.cookie = name + "=" + escape(value) + ";domain=126.com"  + (isForever?";expires="+  (new Date(2099,12,31)).toGMTString():"");
}var sRef = location.search;
var ArrFrom = sRef.split("from=");
if(ArrFrom[1] == null || ArrFrom[1] == "undefined"){
    ArrFrom[1] = "";
}
var gFrom = ArrFrom[1];
document.getElementById("lnkReg").href += gFrom;
window.onresize();
//-->
</script>
<iframe src="http://mimg.163.com/mailvisited/index.htm#126" style="display:none;"></iframe><!--DLEOANNA-->
<a href="http://uinfo.mail.163.com/cgi-bin/hseed/two.pl"></a></html>

解决方案 »

  1.   

    我的代码如下:void CPost2Dlg::OnOK() 
    {
    // TODO: Add extra validation here
    CString strObject; 
    INTERNET_PORT nPort; 
        CString strFormData;
    CString strServer;
    DWORD dwServiceType; 
    CInternetSession g_Session_HG("My Session");
    CHttpConnection* pServer = NULL; 
    CHttpFile* pFile = NULL; 

    CString strURL="http://www.126.com"; 
    CString strRetMsg; 
    strFormData="user=yindoor123&password=123456&style=-1&remUser=checked&secure=checked";
    CString strHeader=_T("Content-Type:text/html; charset=gb2312\r\n");


    if(!AfxParseURL(strURL,dwServiceType,strServer,strObject,nPort)|| 
    dwServiceType != INTERNET_SERVICE_HTTP) 

    MessageBox(_T("不是HTTP站点"),_T("错误")); 
    return ; 


    pServer = g_Session_HG.GetHttpConnection(strServer,nPort); 
    strObject=_T("http://entry.126.com/cgi/login");
    pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,strObject);//NULL,1,NULL,NULL, 

    BOOL result = pFile->SendRequest(strHeader,(LPVOID)(LPCTSTR)strFormData, strFormData.GetLength()); 

    CString str;
    CString a;
    while(pFile->ReadString(a))
    {
    str+=a;
    str+="\r\n";
    }

    SetDlgItemText(IDC_EDIT1,str);
    }
      

  2.   

    现在的问题是如何正确读出登录后的网页 好把它转换成htm文件,放在电脑上
      

  3.   

    使用CINTERNETSESSION类,很容易搞定.
      

  4.   

    CSDN  没高手了吗???????????????????
      

  5.   

    myHttpFile=(CHttpFile*)mySession.OpenURL(myUrl);
      //myHttpFile=(CHttpFile*)mySession.OpenURL(myUrl,1,INTERNET_FLAG_TRANSFER_ASCII,NULL,0);
      //waiting�����ύurl���ȴ�����
      printf("OAϵͳ��¼��,���ȴ�����\n");
      Sleep(3000);
      myHttpFile->QueryInfoStatusCode(dwStatusCode);
      StrdwStatusCode.Format("%d",dwStatusCode);//ת��dwStatusCode����
    if(dwStatusCode==HTTP_STATUS_OK)
    {
    printf("�����ύ�ɹ�:%s\n",StrdwStatusCode);
    printf("״̬:");
    while(myHttpFile->ReadString(myData))
    {
     m_SiteInfo = myData;
     idx=m_SiteInfo.Find("wdbgz.jsp",0);//���ص�idx��һ����0��ʼ��������ָ����λ�þ���m_SiteInfo�е�һ���ַ�
     if(idx!=-1)
     {
      flag=1;
     }
     
    }
    if(flag==1){printf("OAϵͳ��¼�ɹ�!\n");}else{printf("OAϵͳ��¼ʧ��!\n");}
    printf("\n");
    }//end if
    else{printf("�ύurlʧ��!\n"); return 0;}
      

  6.   

    这段代码是我在linux下发的 贴上来有点乱码