CInternetSession* m_pInetSession;
 CFtpConnection* m_pFtpConnection;
 CString strUserName("name");
 CString strPassword("XXXX");
 CString strServerName(ftp.XXX.com);
 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();
 }
                    
                
                
            
        
浙公网安备 33010602011771号