有谁知道有没有办法暂停一个线程的运行?等我再让他运行时他接着运行.

解决方案 »

  1.   

    用SuspendThread()函数
    The SuspendThread function suspends the specified thread. DWORD SuspendThread(
      HANDLE hThread   // handle to thread
    );
    Parameters
    hThread 
    [in] Handle to the thread that is to be suspended. 
    Windows NT/2000 or later: The handle must have THREAD_SUSPEND_RESUME access. For more information, see Thread Security and Access Rights. Return Values
    If the function succeeds, the return value is the thread's previous suspend count; otherwise, it is -1. To get extended error information, use the GetLastError function. 
      

  2.   

    恢复运行用ResumeThread(HANDLE hThread)
      

  3.   

    恢复运行用ResumeThread(HANDLE hThread)
      

  4.   

    SuspendThread(handle),ResumeThread(HANDLE)