1.Browse文件路经CString strDir = BrowseForFolder(m_hWnd, "Select a directory:", BIF_RETURNONLYFSDIRS);
2.ftp:AfxParaseURL()//in 解析输入的url, out 服务器类型(ftp,http...)服务器名 路径 端口,如果出错,检查URL是否有ftp://前缀
service://server/dir/dir/object.ext:port,strServer == "server",strObject == "/dir/dir/object/object.ext",nPort == #port , dwServiceType == #service
1.创建CInternetSession对象用来初始化环境。
2 . CInternetSession.GetFtpConnection()返回CFtpConntection类型,后续依靠这个类型进行ftp操作,可能会跑出CInternetException
CFtpConnection.GetCurrentDirectory获取当前目录,根目录返回“/"
3.CFtpFileFind ftpFind(CFtpConntection *)绑定一个Ftp对象,用成员函数FindFile()/FindFile(filename),FindNextFile()遍历文件目录,如果要获取文件属性应该在这里获取,在别的里面获取可能会出错,用CFtpConnection.SetCurrentDirectory切换路径(..返回上层目录)
4.CInternetFile 对象用来具体的文件上传下载实现,CFtpConnect OpenFile返回该对象实例,后续可以用CInternetFIle.read/write实现上传下载
5.对所有对象执行Close()