Dear all GURUs,

I'm facing a problem with my WaitForMultipleObjects function.
I'm writing a thread to wait for 3 result using event.
When getting all the result, then only i proceed to next step.

I have a start button to trigger the thread start and stop.
After the thread start, my problem will call WaitForMultipleObjects to wait for all the result complete.
If i press stop now, the WaitForMultipleObjects seem to be on going. it did not stop when i press stop.
How can i stop the WaitForMultipleObjects once i stop the thread? if not after the timing, it will proceed to next step.

void CMyFunction::Run()
{
DWORD dwEvent=0;

while(m_bStart)
{
dwEvent = WaitForMultipleObjects(
3, // number of objects in array
m_hEvent, // array of objects
TRUE, // wait for any object
5000); // five-second wait

//proceed to next step
AfxMessageBox("Done");

};
}
Thanks.