unsigned uiThread2ID; HANDLE handle = (HANDLE)_beginthreadex(NULL, 0, ThreadUploadFun, NULL, CREATE_SUSPENDED, &uiThread2ID); ResumeThread(handle); CloseHandle(handle);
unsigned int __stdcall ThreadUploadFun(PVOID pM) { char str[100]; int thread_id = GetCurrentThreadId(); sprintf_s(str, "线程ID号为 % 4d的子线程启动", thread_id);return 0; }
#include <sstream> stringstream str; int thread_id = GetCurrentThreadId(); str << "线程ID号为"<< thread_id<<"的子线程启动"; cout << str.str() << endl;