15,978
社区成员
发帖
与我相关
我的任务
分享
//=================================================================
#include <windows.h>
#include <iostream.h>
void func()
{
int num = 100000;
while (num--)
{
cout<<num<<endl;
}
}
void main()
{
HANDLE m_handle = CreateThread( NULL , NULL , (LPTHREAD_START_ROUTINE)&func , NULL , NULL,NULL);
if (m_handle==NULL)
{
cout<< "error with code:" << GetLastError() <<endl;
return ;
}
WaitForSingleObject(m_handle,INFINITE);
cout<< "run over" << endl;
}
while(bExitFlage)
{
MSG msg;
if(PeekMessage(msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
……
}