#include "FtpDlg.h"
typedef struct
{
CListBox* pList;
CString strFtpSite;
CString strName;
CString strPwd;
}FTP_INFO;
UINT ListContentMT(LPVOID pParam)
{
if (pParam==NULL)
AfxEndThread(NULL);
//获得参数
FTP_INFO* pInfo;
CListBox* pList;
CString strFtpSite;
CString strName;
CString strPwd;
pInfo=(FTP_INFO*)pParam;
pList=pInfo->pList;
strFtpSite=pInfo->strFtpSite;
strName=pInfo->strName;
strPwd=pInfo->strPwd;
CInternetSession* pSession;
CFtpConnection* pConnection;
CFtpFileFind* pFileFind;
CString strFileName;
BOOL bContinue;
pConnection=NULL;
pFileFind=NULL;
//创建Internet会话
pSession=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
//试图建立FTP连接
pConnection=pSession->GetFtpConnection(strFtpSite,strName,strPwd);
}
catch(CInternetException* e)
{
//错误处理
e->Delete();
pConnection=NULL;
}
if (pConnection!=NULL)
{
//创建CFtpFileFind对象
//传递CFtpConnection对象指针
pFileFind=new CFtpFi
VC FTP多线程上传下载
最新推荐文章于 2020-03-20 14:37:19 发布
该博客介绍了一种使用VC++实现FTP多线程上传和下载的方法。通过创建CInternetSession对象,建立FTP连接,然后使用CFtpConnection进行文件的查找、下载和上传。博客中详细展示了如何实现多线程来并发处理文件操作,包括查找目录内容和下载/上传文件的函数实现。

最低0.47元/天 解锁文章
3937

被折叠的 条评论
为什么被折叠?



