添加线程函数:
UINT WriteW(LPVOID pParam)
{
//CEdit *pEdit=(CEdit*)pParam;
//pEdit->SetWindowText("");
//Do something, 如启动一个设备开始工作等等,类似生产者和消费者的模型
return 0;
}
CWinThread *pThread=AfxBeginThread(WriteW, &m_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
pThread->ResumeThread();
//WaitForSingleObject(pThread, INFINITE);
在MFC中使用的工作线程有:MFC线程,C Run运行时线程,Boost线程。
boost::thread thrd(BoostThreadFunc); //Boost线程
_beginthread(CRunThreadFunc,0,NULL); //C Run运行时线程(不用)
_beginthreadex(NULL, 0, ThreadFunEx, NULL, 0, NULL);
pThread=AfxBeginThread(ThreadFunc,NULL,THREAD_PRIORITY_NORMAL); //MFC线程
MFC 线程
猜你喜欢
转载自blog.csdn.net/tony2278/article/details/85112361
今日推荐
周排行