hi, as with the topic, i am a newbie at MFC programming and ii am having trouble with DoModal
it shows the window but immediately give an assertion error
http://img186.imageshack.us/img186/9563/assert9dk.jpg
here's how the application init looks like:
Code:
BOOL CAsevApp::InitInstance()
{
time_stop_dlg dlg;
m_pMainWnd = &dlg;
AfxBeginThread ( th_start_accept, (LPVOID)this );
return TRUE;
}
over here, time_stop_dlg is a class derived from CDialog, without any changes, but has been linked to IDD_MY_DIALOG_TO_SHOW (as suggested by classwizard)
this is the thread procedure:
Code:
UINT CAsevApp::th_start_accept( LPVOID lpvParam )
{
CAsevApp *th_start_accept = (CAsevApp*)lpvParam;
th_start_accept->process_received_msg(buffer);
return 0;
}
process_received_msg(buffer) is a function member of CAsevApp
Code:
void CAsevApp::process_received_msg(char *msg)
{
time_stop_dlg time_stop_dlg_obj;
time_stop_dlg_obj.DoModal(); // NIGHTMARE BEGINS HERE!
}
a snippet of wincore assertion error:
Code:
BOOL PASCAL CWnd::WalkPreTranslateTree(HWND hWndStop, MSG* pMsg)
{
ASSERT(hWndStop == NULL || ::IsWindow(hWndStop));
ASSERT(pMsg != NULL);
// walk from the target window up to the hWndStop window checking
// if any window wants to translate this message
for (HWND hWnd = pMsg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd))
{
CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
if (pWnd != NULL)
{
// target window is a C++ window
if (pWnd->PreTranslateMessage(pMsg))
return TRUE; // trapped by target window (eg: accelerators)
}
// got to hWndStop window without interest
if (hWnd == hWndStop)
break;
}
return FALSE; // no special processing
}
http://img186.imageshack.us/img186/7370/retrn0wk.jpg
using
vc6.0 sp6
your assistance please!