Re: threads won't close and then reopen correctly...
"RAB" <rabmissouri@yahoo.com> wrote in message
news:c5483a5c-388b-45e6-83fa-a5381a54f50d@m45g2000hsb.googlegroups.com...
I have a MFC VC++ project that has a thread started in the
OnInitDialog() function of a dialog box.
AfxBeginThread(ThreadProcess, (LPVOID) this, 0);
I handle the thread in the the following function
UINT Questions::ThreadProcess(LPVOID param)
{
//do some stuff
AfxEndThread(0);
return 0;
}
Everything works well until I close the dialog box and then reopen
it. When I do that the thread doesn't work as it should the second
time around. Anyone have any thoughts on why I am getting this
unwanted behavior and what I can do to correct it?
Does your "//do some stuff" section use the passed parameter after the
dialog is destroyed? That could be bad.
Otherwise there's nothing I can see in the code shown that should be a
problem. The debugger should help :)
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
Thanks in advance,
RABMissouri2008