c++ 创建线程以及参数传递

时间:2023-01-25 15:17:22
//创建线程,传递参数
DWORD dwThreadID = ;
HANDLE hThread = CreateThread(NULL, , MonitorThreadFunction, this , , &dwThreadID);
//线程过程定义及参数接收
DWORD WINAPI MonitorThreadFunction(LPVOID lpParam)
{
CValidator* securityValidator = static_cast<CValidator*>(lpParam); while(true)
{
Sleep();
securityValidator->fireValidateEvent();
} /*MessageBox(NULL,L"thread",L"start",0);*/ return ;
}