你的位置:
问答吧
-> C/C++
-> 问题详情
多线程ftp下载的多线程概念
UINT DownloadFileMT(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;
int nSel=pList->GetCurSel();
CString strSourceName;
pList->GetText(nSel,strSourceName);
if (strSourceName.GetAt(0)!='[')
{
CString strDestName;
CFileDialog dlg(FALSE,"","*.*");
if (dlg.DoModal()==IDOK)
{
strDestName=dlg.GetPathName();
if (GetFileMT(strFtpSite,strName,strPwd,strSourceName,strDestName))
AfxMessageBox("下载成功!",MB_OK|MB_ICONINFORMATION);
else
{
AfxMessageBox("下载失败!",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
else
{
AfxMessageBox("请写入文件名!",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
else
{
AfxMessageBox("不能下载目录!\n请重选!",MB_OK|MB_ICONSTOP);
return FALSE;
}
return 0;
}
这是在网上找的源码 作者说是多线程下载 怎么就看不出来? 有哪个高人能教我写下下载上传的多线程代码么?
作者: yujunraining
发布时间: 2010-12-13
没人回答么?...
作者: yujunraining
发布时间: 2010-12-13
这个函数应该只是用的线程函数吧
完整代码里应该是包含启动线程的代码
作者: xjy1204
发布时间: 2010-12-13
看看用了,CreateThread,_beginthread,_beginthreadex,AfxBeginThread等函数没
作者: fishion
发布时间: 2010-12-13
http://u.115.com/file/f25073153c 这个是源码 希望能抽空帮我看看 谢谢
作者: yujunraining
发布时间: 2010-12-13
引用 3 楼 fishion 的回复:
看看用了,CreateThread,_beginthread,_beginthreadex,AfxBeginThread等函数没
用了AfxBeginThread函数 我在网上查的一些资料说把文件分块 然后用多线程下载 再合并 可是不会实现。。
作者: yujunraining
发布时间: 2010-12-13
那段代码是个线程执行函数!!
作者: dingshaofengbinbin
发布时间: 2010-12-13