Click here to Skip to main content
15,906,947 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello, i have 2 modal dialogs in my app. From the first one when i press ENTER(using PreTranslateMessage) i calls me the second one by DoModal().
But from the second, when i press Escape key, or click the 'X', or press Alt+F4 to close it, it gives me an ASSERT error in file wincore.cpp on line 875. Here is the error from wincore.cpp file:

C#
void CWnd::OnFinalRelease()
{
    if (m_hWnd != NULL)
        DestroyWindow();    // will call PostNcDestroy
    else                 // IT POINTS THIS LINE
        PostNcDestroy();
}


I'm having just DoModal from Dialog1 and nothing else. Even i don't use any pieces of code in Dialog2(the second dialog).

I've been trying to avoid that error myself but i wasn't able to.
Thanks in advance, any help would be appreciated!
Posted
Updated 20-Mar-10 3:19am
v2

Please post your OnEnter scope of the first dialog
and the class definition of the second dialog :)

Can you close yor first dialog without the failed assertions ?
 
Share this answer
 
Let me guess ur points-

CDialog1->EnterKey->CDialog2 //This works fine ri8?
May be you have written the code against Enter Key likewise-

CDialog2 Dlg2;
Dlg2.DoModal();

And the Dlg2 appear successfully (That is what desired)

But from second dialog if you cancle this it will surely produce error, because, that holds the handle of First Dialog.

Try this once:

Set one CloseDialog Button in the Second Dialog and write code for that
CDialog2::OnCloseDialog()
{
CDialog2::OnOK();
}

This will ensure the termination of the Second dialog in proper way I guess
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900