first of all Thanku Mr.Doug Forster for ur response.
My scenario is:
In CMainframe class , I add my own class called CChildWindow
which is derived from CScrollview. In CChildWindow I added my own class
called CPagewindow which is been derived from CFrameWnd.The place where
I get error is , While I am trying to close my main application,
CMainframe's OnClose() is called which in turn calls CChildWindow's
OnClose() where the Pagewindow->DestroyWindow() is called. Here only
the assertion occurs.
CMainframe -> CChildWindow -> CPageWindow -> DestroyWindow()
The Code follows as:
void CMainFrame::OnClose()
{
GlobalMembers::m_PageWindowHandle=m_ChildWnd->m_structPgDetails[i].PageHandle;
m_ChildWnd->OnClose();
CFrameWnd::OnClose();
}
void CChildWindow::OnClose()
{
pagewindow->DestroyWindow();
}
///// Asserts here in destroy window
Debug Assertion Failed!
> > program:................
> > File: wincore.cpp
> > Line: 958
/////
> Hi,
>
[quoted text clipped - 30 lines]
> > Thanks
> > Mullai
Doug Forster - 18 Jul 2006 23:09 GMT
Hi,
Well I don't fully understand your window structure, but usually if they are
all parented correctly you shouldn't need to do anything special to close
child windows - the MFC infrastructure will handle it. So the first thing to
try is simply commenting out much of your closing code - the assertion is
just telling you that the window is already gone. If for some reason you DO
need to explicitly close a window then the usual way is to simply Post a
WM_CLOSE and let the infrastructure handle the rest. Usually the only
situation you need to explicitly call DestroyWindow in MFC is during the
shutdown handling of a modeless dialog.
Cheers
Doug Forster
> first of all Thanku Mr.Doug Forster for ur response.
>
[quoted text clipped - 67 lines]
>> > Thanks
>> > Mullai
Mullai - 26 Jul 2006 06:11 GMT
Hi,
I tried by sending a window Message (WM_CLOSE) . Even then the
problem occurred. I then found out this error is because of the current
thread state. SO I added AFX_MANAGE_STATE(Afxgetappmodulestate())
before the window message. The problem is solved.
THANK U FOR YOUR KIND HELP.
REGARDS,
Mullai.P
> Hi,
>
[quoted text clipped - 82 lines]
> >> > Thanks
> >> > Mullai