用ftp下载文件时,如何加上进度条监控下载的情况? 如题!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CDemoDlg::ftpConnect(CString ipaddr,CString user,CString pwd,const char * remote,const char * local){ CInternetSession* pSession; CFtpConnection* pConnection=NULL; CFtpFileFind* pFileFind=NULL; CString strFileName; UINT CanDownFileNum = 0; USHORT ResltValue; CString str; ResltValue = 0; UpdateWindow(); UpdateWindow(); pSession = new CInternetSession(AfxGetAppName(), 1, INTERNET_OPEN_TYPE_PRECONFIG ); try{ pConnection = pSession->GetFtpConnection(ipaddr, user, pwd); } catch(CInternetException* e) { e->ReportError(); e->Delete(); pConnection = NULL; ResltValue = 0; delete pSession; return; } BOOL bResult = pConnection->GetFile(remote,local,TRUE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY,1); if(!bResult) AfxMessageBox("Get File Faild"); else AfxMessageBox("Get File Success"); if (pConnection!=NULL) { pConnection->Close(); delete pConnection; } delete pSession;}这是我用VC写的ftp下载,可是如何用进度条跟踪文件的大小情况,请大家给点好的建议!我不胜感谢! 如果你想要加上进度条,你就要自己用socket封装ftp协议了,然后根据发送和接收的数据包的数量,计算进度 CInetAPI也可以,看看这个:http://www.prim-tech.com/list.asp?id=57 怎样拦截打印软件发送到打印机的数据? 这个Sql语句怎样写 MFC中怎么创建Dialog继承其他Dialog ? button问题 VC++最基础的一个问题 访问冲突 类析构时候的问题,谢谢帮忙 初学者:请问如何以CDC的形式得到对话框中的某个static控件 怎样让vss认为*.sql是文本文件? 如何做一个256色位图的ToolBar? CloseHandle()函数的使用?? 如何去掉文档窗口的标题栏阿?在线等,保证给分!!!!!!!!!!
{
CInternetSession* pSession;
CFtpConnection* pConnection=NULL;
CFtpFileFind* pFileFind=NULL;
CString strFileName;
UINT CanDownFileNum = 0;
USHORT ResltValue;
CString str;
ResltValue = 0;
UpdateWindow(); UpdateWindow();
pSession = new CInternetSession(AfxGetAppName(), 1, INTERNET_OPEN_TYPE_PRECONFIG );
try{
pConnection = pSession->GetFtpConnection(ipaddr, user, pwd);
}
catch(CInternetException* e)
{
e->ReportError();
e->Delete();
pConnection = NULL;
ResltValue = 0;
delete pSession;
return;
} BOOL bResult = pConnection->GetFile(remote,local,TRUE,FILE_ATTRIBUTE_NORMAL,FTP_TRANSFER_TYPE_BINARY,1);
if(!bResult)
AfxMessageBox("Get File Faild");
else
AfxMessageBox("Get File Success"); if (pConnection!=NULL)
{
pConnection->Close();
delete pConnection;
}
delete pSession;
}这是我用VC写的ftp下载,可是如何用进度条跟踪文件的大小情况,请大家给点好的建议!
我不胜感谢!