if(m_hTread != NULL)
{
g_ulAbortDownload = 0;
GetDlgItem(IDOK)->EnableWindow(FALSE);
//::CloseHandle(m_hTread); //此处线程运行函数退出的时候再closeHandle 否则 挂起线程会失败
}
else // 创建线程失败
{
MessageBox(g_language.GetString(7,_T("Create Thread Fail...")).c_str(),g_language.GetString(4,_T("TIP")).c_str(),MB_ICONWARNING|MB_TOPMOST);
GetDlgItem(IDOK)->EnableWindow(TRUE);
}
dwCode = SuspendThread(m_hTread); //点击取消时挂起线程 不一定挂起 句柄结构中 nThreadSuspendCount 是否《=0
if(dwCode == 0xffffffff)
挂起失败
Sleep(10000);
ResumeThread(m_hTread); //重新唤醒线程运行
1,线程的handle用处:
2,CloseHandle()作用
3,不执行CloseHandle() 带来的后果
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/apple_operation/archive/2007/09/12/1782239.aspx