#include #include unsigned __stdcall _threadfun(void* pParam){ while(TRUE) { printf("hello world"); }}int main(int argc, char* argv[]...
#include <windows.h> #include <process.h> unsigned __stdcall _threadfun(void* pParam) { while(TRUE) { printf("hello world"); } } int main(int argc, char* argv[]) { unsigned uThreaID; _beginthreadex(NULL,0,_threadfun,NULL,NULL,&uThreaID); //不調用ExitThread,主線程執行完成退出,crt會終止所有的線程,進程退出 //如果調用了ExitThread退出主線程,crt不會終止其他的線程,雖然主線程退出了,進程仍然在 ExitThread(1);//顯示調用ExitThread結束主線程,進程不退出 return 0; }