while(true)
{
CopyFile(strSource, strDest + index, true);
.....
....
if(finishcopy)
break;
}
要单独启动一个线程还是我这样的用法不对?

解决方案 »

  1.   

    用单独一个线程吧,不要在主线程中用CopyFile
      

  2.   

    应该说不要在主线程中用while(true)这样的死循环
      

  3.   

    不要用CopyFile,用SHFileOperation,可以显示进度
      

  4.   

    死循环,当然卡死了,要用sleep使线程暂停下,平均0.01s暂停下
      

  5.   

    加个进度条,再peek一下message。
      

  6.   

    while(1)中加:
    if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
    {
    if(msg.message == WM_QUIT)break;
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    //等效于VB中的DoEvent
      

  7.   

    感谢大家的答复 将copyfile放到线程中处理 果然就不影响界面操作了