线程挂起,和恢复都不能起到作用,为什么?
OnInitDialog函数下添加
HThread=AfxBeginThread(ThreadFun,NULL,0,0,CREATE_SUSPENDED,NULL);
UINT ThreadFun(LPVOID LPARAM){ int Count=0; char Temp[100]; while(1) { if(flag) { Count++; sprintf(Temp,"%d",Count); SetDlgItemText(AfxGetApp()->m_pMainWnd->m_hWnd,IDC_EDIT1,Temp); } } return 0;}void CThreadTestDlg::OnBegin() { flag=TRUE; TRACE("Resumethread"); ResumeThread(HThread);}void CThreadTestDlg::OnStop() { flag=FALSE; SuspendThread(HThread); }