1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
HANDLE hThread;
DWORD dwGenericThread;
hThread = CreateThread(NULL,0,SampleThread,NULL,0,&dwGenericThread);
if(hThread == NULL)
{
DWORD dwError = GetLastError();
cout<<"SCM:Error in Creating thread"<<dwError<<endl ;
return;
}
hEvent = CreateEvent(NULL,FALSE,FALSE,"Test");
cout<<"Started waiting for the thread to complete.."<<endl ;
WaitForSingleObject(hEvent,INFINITE);
cout<<"Thread Completed."<<endl ;
CloseHandle(hEvent); |