unsigned __stdcall fangdiaoshiThread(void * lParam) { while (true) { DWORD dwTime = GetTickCount(); Sleep(1000); if ((GetTickCount() - dwTime) > 2000) ExitProcess(-1); } } int main() { CloseHandle((HANDLE)_beginthreadex(nullptr, 0, fangdiaoshiThread, NULL, NULL, nullptr)); //这里省略一推代码 return 0; }
原文:http://www.cnblogs.com/xiaohaige/p/7653485.html