
CInternetSession* pSession;
pSession = new CInternetSession; //构造新的连接
CFtpConnection* pFtpCon;
pFtpCon = pSession->GetFtpConnection("192.168.135.110","cheng",NULL,21);//连接FTP服务器
CFtpFileFind ftpfind(pFtpCon);
if (ftpfind.FindFile(NULL)) //查找所有的文件
{
CString str ;
while ( ftpfind.FindNextFile())
{
if (!ftpfind.IsDirectory()) //判断是否是目录
{
str = ftpfind.GetFileName();
m_list.AddString(str);
}
}
if (!ftpfind.IsDirectory())
{
str = ftpfind.GetFileName();
m_list.AddString(str);
}
}
delete pSession;