WalterGong
Programmer
Dear sir:
I create two threads in my program and try to update data in the child thread with the function UpdateData(). When I run the program, I got a "Debug Assertion Failed" error.
The assertion is "ASSERT:IsWindow(m_hWnd)); // calling UpdateData before DoModal?" in ...\Mfc\Src\Wincore.cpp.
The followings are my program:
UINT ChildThread(LPVOID param)
{
CCpu12Dlg aCpu12Dlg;
CString startPC=aCpu12Dlg.GetStartPC();
if( Interrupt == 0 )
{
aCpu12Dlg.m_lEdit_Time=111;
aCpu12Dlg.UpdateData(false); // Something is wrong here
}
return 0;
}//End of UINT ChildThread(LPVOID param)
void CCpu12Dlg::OnRun()
{
UpdateData(true);
runAddress=" "+m_sReg_PC+" ";
Interrupt = 0 ;
AfxBeginThread(ChildThread, NULL);
}//End of void CCpu12Dlg::OnRun()
Please tell me what the wrong with my program, thank you in advance.
Walter
I create two threads in my program and try to update data in the child thread with the function UpdateData(). When I run the program, I got a "Debug Assertion Failed" error.
The assertion is "ASSERT:IsWindow(m_hWnd)); // calling UpdateData before DoModal?" in ...\Mfc\Src\Wincore.cpp.
The followings are my program:
UINT ChildThread(LPVOID param)
{
CCpu12Dlg aCpu12Dlg;
CString startPC=aCpu12Dlg.GetStartPC();
if( Interrupt == 0 )
{
aCpu12Dlg.m_lEdit_Time=111;
aCpu12Dlg.UpdateData(false); // Something is wrong here
}
return 0;
}//End of UINT ChildThread(LPVOID param)
void CCpu12Dlg::OnRun()
{
UpdateData(true);
runAddress=" "+m_sReg_PC+" ";
Interrupt = 0 ;
AfxBeginThread(ChildThread, NULL);
}//End of void CCpu12Dlg::OnRun()
Please tell me what the wrong with my program, thank you in advance.
Walter