unsigned int WINAPI ThreadProc(LPVOID pParam)
{
CString s;
for (int i = 0; i < 100; i++)
{
s.Format(L"Loop %d finished\r\n", i);
OutputDebugString(s);
}
return 0;
}
void OnBnClickedButton()
{
unsigned int id;
HANDLE handle = (HANDLE)::_beginthreadex(0, 0, ThreadProc, (void*)this, 0, &id);
/*等待線程退出*/
/*
DWORD dRet = WaitForSingleObject(handle, INFINITE);
if (dRet == WAIT_OBJECT_0)
{
//線程結束
}
*/
}