欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>程序设计>>杂项>>文章内容
CHttpFile网络交互功能实现...
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

程序内部读取网络信息, 该代码可以通过网络提交验证密码再进行判断... 

CInternetSession mySession(NULL,0);
 CHttpFile* myHttpFile=NULL;

 CString myData;
 CString myUrl;
 myUrl = "; + m_myName + "&password=" + m_myPassword;
 myHttpFile=(CHttpFile*)mySession.OpenURL(myUrl);
 while(myHttpFile->ReadString(myData))
 {
             m_SiteInfo = myData;
 }
 
 if( m_SiteInfo == "hao" ){
         CDialog::OnCancel();
 }else{
         AfxMessageBox( "密码错误", NULL, MB_OK );
 }

 myHttpFile->Close();
 mySession.Close();

-----------------------------------------------

CHttpFile Class Members

Construction

CHttpFileCreates a CHttpFile object.

Operations

AddRequestHeadersAdds headers to the request sent to an HTTP server.SendRequestSends a request to an HTTP server.SendRequestExSends a request to an HTTP server using the Write or WriteString methods of CInternetFile. EndRequestEnds a request sent to an HTTP server with the SendRequestEx member function. QueryInfoReturns the response or request headers from the HTTP server. QueryInfoStatusCodeRetrieves the status code associated with an HTTP request and places it in the supplied dwStatusCode parameter.GetVerbGets the verb that was used in a request to an HTTP server.GetObjectGets the target object of the verb in a request to an HTTP server.GetFileURLGets the URL for the specified file.CloseCloses the CHttpFile and frees its resources.
附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步