Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2006

Tip: Looking for answers? Try searching our database.

Wincore Debug assertion failed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mullai - 17 Jul 2006 08:13 GMT
Hi ,
My program gives an error message like this

Debug Assertion Failed!
program:................
File: wincore.cpp
Line: 958

Please can anyone help me out in this issue. I have to solve this bug
immediately in my project.
The line 958 is as follows in wincore.cpp

When I am trying to close my window  created CFrameWnd class by calling
DestroyWindow() this assertion has been asserted.

BOOL CWnd::DestroyWindow()
{
       if (m_hWnd == NULL)
               return FALSE;

       CHandleMap* pMap = afxMapHWND(); ///// line 958/////
       ASSERT(pMap != NULL);
       CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);

Thanks
Mullai
Doug Forster - 17 Jul 2006 23:00 GMT
Hi,

You wouldn't normally call DestroyWindow for a CFrameWnd. Could you explain
why you are trying to do this and show us some of your code.

Cheers
Doug Forster

> Hi ,
> My program gives an error message like this
[quoted text clipped - 22 lines]
> Thanks
> Mullai
Mullai - 18 Jul 2006 11:19 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.