niguding 发表于 2006-9-14 19:26:00

关于网络的问题[求助]

<P>在.arx中要实现ftp服务器的文件的上传和下载,把已经能实现上传和下载功能的类拷贝到工程中却怎么也连接不上服务器,不知道是为什么。</P>
<P>下面是实现连接的函数,希望那位大侠给点意见,小弟先谢谢了。</P>
<P>void CDlgLogin::OnConnect() <BR>{<BR>&nbsp;UpdateData(TRUE);</P>
<P>&nbsp;//新建对话<BR>&nbsp;m_pInetSession=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);<BR>&nbsp;try <BR>&nbsp;{ <BR>&nbsp;&nbsp;//新建连接对象<BR>&nbsp;&nbsp;m_pFtpConnection=m_pInetSession-&gt;GetFtpConnection(m_strServer,m_strUserName,<BR>&nbsp;&nbsp;&nbsp;m_strPassword); <BR>&nbsp;} <BR>&nbsp;catch(CInternetException *pEx) <BR>&nbsp;{<BR>&nbsp;&nbsp;//获取错误<BR>&nbsp;&nbsp;TCHAR szError;<BR>&nbsp;&nbsp;if(pEx-&gt;GetErrorMessage(szError,1024))<BR>&nbsp;&nbsp;&nbsp;AfxMessageBox(szError);<BR>&nbsp;&nbsp;else&nbsp; <BR>&nbsp;&nbsp;&nbsp;AfxMessageBox("There was an exception");<BR>&nbsp;&nbsp;pEx-&gt;Delete();<BR>&nbsp;&nbsp;m_pFtpConnection=NULL;</P>
<P>&nbsp;&nbsp;return;<BR>&nbsp;}<BR>&nbsp;m_pRemoteFinder = new CFtpFileFind(m_pFtpConnection);</P>
<P>&nbsp;//获得服务器根目录的所有文件并在列表框中显示<BR>&nbsp;BrowseDir("",&amp;m_ctrlRemoteFiles,m_pRemoteFinder,&amp;m_arrRemoteFiles);<BR>&nbsp;<BR>}</P>
页: [1]
查看完整版本: 关于网络的问题[求助]