timmay3141
Programmer
I have a thread in which I need to constantly update a dialog bar of my SDI app. The update function works fine when not called in my thread, but it crashes when the thread calls it. Here's my thread, minus irrelivent code:
UINT CModelView::HandleThread(LPVOID lp)
{
CModelView* pView = (CModelView*)lp;
while(pView->m_bRunning)
{
if(something)
pView->UpdateDlgBar();
//do other stuff
}
return 0;
}
I traced the actual error to when I call GetParentFrame() in UpdateDlgBar, which is one of the first things I do. Anyway, why does this cause an error, and how can I fix it?
UINT CModelView::HandleThread(LPVOID lp)
{
CModelView* pView = (CModelView*)lp;
while(pView->m_bRunning)
{
if(something)
pView->UpdateDlgBar();
//do other stuff
}
return 0;
}
I traced the actual error to when I call GetParentFrame() in UpdateDlgBar, which is one of the first things I do. Anyway, why does this cause an error, and how can I fix it?