DWORD WINAPI ThreadProc(LPVOID pParam)
{
return 0;
}
DWORD nThreadID = 0;//保存线程ID
HANDLE hThread = NULL;//保存线程句柄
hThread = CreateThread(NULL,0,ThreadProc1,NULL,0,&nThreadID);//创建线程立刻执行,参数为0
DWORD nValue = 100;//将变量传递出去
CreateThread(NULL,0,ThreadProc1,(LPVOID)nValue,CREATE_SUSPENDED,&nThreadID);//创建一个挂起线程(默认不会执行)
DWORD nValue = (DWORD)pParam;
TerminateThread(m_hThreadHandle,0); // 线程句柄
ResumThread(HANDLE hThread);
SuspendThread(HANDLE hThread);
ExitThread
WaitForSingleObject(HANDLE,INFINITE); // 等候线程结束
CloseHandle
HANDLE hAndle[2] = {NULL};
WaitForMultipleObjects(2/*句柄数量*/,hAndle/*句柄数组*/,TRUE/*TRUE等候所有句柄事件|FALSE等候其中一个句柄事件*/,INFINITE/*等候时间 无限等候*/);