关于CFtpConnection同时下载文件的问题
#define DL_BUFFER_SIZE 4096#define PROGRESS_REPORT WM_USER + 1BOOL CFtpClient::Download(CString sourcename, CString destpath, HWND hwnd){ CString sourcepath; BOOL bl = FindFile(sourcename, sourcepath); if (bl == FALSE) { return FALSE; } CInternetFile* FtpFile = m_pFtpCon->OpenFile(sourcepath); CFile LocalFile; if(LocalFile.Open(destpath, CFile::modeCreate | CFile::modeWrite, NULL) == FALSE) { return FALSE; } char buffer[DL_BUFFER_SIZE]; unsigned int amount_read = DL_BUFFER_SIZE; unsigned int total_read = 0; while (amount_read == DL_BUFFER_SIZE) { amount_read = FtpFile->Read(buffer, DL_BUFFER_SIZE); LocalFile.Write(buffer, amount_read); PostMessage(hwnd, PROGRESS_REPORT, 0, 0); //给调用窗口发进度消息 } FtpFile->Close(); LocalFile.Close(); return TRUE;}