#include <afxwin.h>
#include <iostream>
using namespace std;
UINT ThreadProc(LPVOID)
{
for(int i=0;i<100;i++)
cout<<i<<endl;
return 0;
}
void main(int argc,TCHAR*argv[])
{
//Step 1 创建线程、“挂起”线程
CWinThread *pThread = AfxBeginThread(ThreadProc,NULL,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED,NULL);
//Step 2 设为“非自动删除”、恢复线程
pThread->m_bAutoDelete = FALSE;
ResumeThread(pThread->m_hThread);
//Step 3 线程结束、“手动删除”p......
阅读全文