CWinThread* m_pWinThread;
m_pWinThread=AfxBeginThread(MyThreadHandler, this);//这就起了
MyThreadHandler函数如下:
.h:
static UINT MyThreadHandler(LPVOID lpParam);
.cpp
UINT CTidyInfoFPDlg::MyThreadHandler(LPVOID lpParam)
{
//设置一个循环就能作为监听或者实现其他功能
while (bGoOn)
{
}
}
外部可以这样去终止线程:
TerminateThread(m_pWinThread->m_hThread,GetExitCodeThread(m_pWinThread,0));