解决方案 »

  1.   


    BOOL GetExitCodeThread(  HANDLE hThread,      // handle to the thread
      LPDWORD lpExitCode   // termination status);你确认CWinThread *m_pThread;可以当HANDLE用?还有你结束线程要看这句
     To end the thread, call AfxEndThread from within the thread, or return from the controlling function of the worker thread.
    也就是说你按了结束线程按钮,这个AfxEndThread(ExitCode,true); 要在你的工作线程里执行的
      

  2.   

    点选开启线程按钮,这个时候线程函数已经启动,但是在sleep这块不到10秒,是不会继续执行下去,在这个时候点选结束线程按钮,
    GetExitCodeThread(m_pThread,&ExitCode);
     //p为需要销毁的CWindThreadZ指针,其在创建线程时可以拿到.
    if(ExitCode>0 )
     AfxEndThread(ExitCode,true); 
    ExitCode 返回值等于0