CFtpDownload::CFtpDownload(CDownloadDlg * CDownload,CStringArray * t_Csa, DWORD ctout)
{
CWinThread * dl_thread = AfxBeginThread(::DownLoadFunction, this);//Start downloading thread
while (thread_finished_flag == FALSE);
result_str = "下载文件结束";}
UINT DownLoadFunction(LPVOID lParam)
{
CFtpDownload * pFtpI = (CFtpDownload *)lParam
pFtpI->thread_finished_flag = TRUE;//Let the main thread know we finished
return 0
}
{
CWinThread * dl_thread = AfxBeginThread(::DownLoadFunction, this);//Start downloading thread
while (thread_finished_flag == FALSE);
result_str = "下载文件结束";}
UINT DownLoadFunction(LPVOID lParam)
{
CFtpDownload * pFtpI = (CFtpDownload *)lParam
pFtpI->thread_finished_flag = TRUE;//Let the main thread know we finished
return 0
}
解决方案 »
- activex连接ftp
- 非模态对话框关闭时的消息?
- 弹出的菜单有ID吗?
- 讨论 VC界面
- 关机代码失败:使用ZwShutdownSystem(native API)在WIN2000下可以关机,在WINDOWS ME下关机失败
- 狼来了,狼来了!
- 在那里可以找ADO返回的ErrorCode的定义?
- 想请教关于界面的一些问题
- 我想用directshow做一个捕获程序,要求将捕获的数据压缩成mpeg格式
- 个位看官,我不理解下面的情况(关于dll的)
- 如何在Picture的OnLButtonDown成员函数中用自定义的画笔画图?
- 在98里大量的频繁的调用DrawText,程序会因资源不足而死掉,怎么解决?
while (thread_finished_flag == FALSE) Delay(10);
while (thread_finished_flag == FALSE) Sleep(10);
用WaitForSingleObject(dl_thread->m_hThread, INFINITE);替换while循环
还可以用CreateEvent和SetEvent
我在线程里又设置了主界面窗口的显示内容,CFTPDownLoadFiles::CFTPDownLoadFiles(CFtpDownload * t_pFtpI)
{
pFtpI = t_pFtpI;
wsprintf(status_str, "正在连接服务器 %s", pFtpI->Csa->GetAt(0));
pFtpI->CDownDlg1->SetStatus(status_str);//执行该句死机
}
while (thread_finished_flag == FALSE) Sleep(100);
CFTPDownLoadFiles::CFTPDownLoadFiles(CFtpDownload * t_pFtpI)
{
pFtpI = t_pFtpI;
wsprintf(status_str, "正在连接服务器 %s", pFtpI->Csa->GetAt(0));
pFtpI->CDownDlg1->SetStatus(status_str);//执行该句死机
}如果不线程同步的话,不会死机
哪位兄弟有时间我把源码发过去,帮我调试一下,我把这个帖子结一下,另开