好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

一段连接FTP的VC代码

一段连接FTP的VC代码

 CInternetSession* m_pInetSession;
 CFtpConnection* m_pFtpConnection;



 CString strUserName("name");
 CString strPassword("XXXX");
 CString strServerName( ftp.XXX测试数据 );
 CString strObject("/");

 if (m_pFtpConnection != NULL)
  m_pFtpConnection->Close();
 delete m_pFtpConnection;
 m_pFtpConnection = NULL;

 CWaitCursor cursor;

 try
 {
  m_pFtpConnection = m_pInetSession->GetFtpConnection(strServerName,strUserName,strPassword);
 }
 catch (CInternetException* pEx)
 {
  TCHAR szErr[1024];
  if (pEx->GetErrorMessage(szErr, 1024))
   AfxMessageBox(szErr, MB_OK);
  else
   AfxMessageBox(IDS_EXCEPTION, MB_OK);
  pEx->Delete();

  m_pFtpConnection = NULL;
 }

 if (m_pFtpConnection != NULL)
 {
  m_FtpTreeCtl.PopulateTree(m_pFtpConnection, strObject);
 }
 else
 {
  m_FtpTreeCtl.PopulateTree();
 }

查看更多关于一段连接FTP的VC代码的详细内容...

  阅读:46次