您的位置:首页 > 其它

MFC创建线程01 AfxBeginThread

2012-03-08 21:24 507 查看
 
//Step 0  设置 “在共享DLL中使用MFC”

//Step 1  包含头文件< afxwin.h>
#include <afxwin.h>
#include <iostream>
using namespace std;

//Step 3 线程函数 返回值、参数
UINT ThreadProc(LPVOID)
{
for(int i=0;i<10;i++)
cout<<i<<endl;

return 0;
}

void main(int argc,TCHAR*argv[])
{
//Step 2  CWinThread  AfxBeginThread()
CWinThread *pThread = AfxBeginThread(ThreadProc,NULL);

Sleep(1000);

//Step 4 CWinThread自动delete、CloseHandle()
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mfc delete dll null