Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP!!!! : Assertion: DestroyWindow

361 views
Skip to first unread message

Jose Daniel Garcia Sanchez

unread,
Apr 3, 1998, 3:00:00 AM4/3/98
to

I have a program where I create several modeless dialog windows.

When I call DestroyWindow, I get an assertion in

File: Wincore.cpp
Line: 900

Has anybody an idea, why this can happen ?


--
José Daniel García Sánchez
Soft Sur / SIEMENS ATD TD5 SR
Werner Von Siemens Strasse, 60
91052 Erlangen
Germany

Phone: +49 9131 7 43135
e-mail: mailto:Daniel...@caesar.erlm.siemens.de

SaberTooth

unread,
Apr 4, 1998, 3:00:00 AM4/4/98
to

I had a similar problem with assertion. What i did is that i simply deleted
the ASSERT statements in my program (they are only used for debugging)

SaberTooth

Rajesh Parikh (MCSD)

unread,
Apr 6, 1998, 3:00:00 AM4/6/98
to

have a look at this article
Foundation Classes Common Asserts, Causes and Solutions
Article ID: Q117326
http://support.microsoft.com/support/kb/articles/q117/3/26.asp

--
-------------------------------------------------------
Rajesh Parikh
Microsoft Certified Solution Developer
rpa...@usa.net
-------------------------------------------------------

Jose Daniel Garcia Sanchez wrote in message
<3524877E...@caesar.erlm.siemens.de>...

Gordon Walker

unread,
Apr 7, 1998, 3:00:00 AM4/7/98
to

SaberTooth wrote:

>I had a similar problem with assertion. What i did is that i simply deleted
>the ASSERT statements in my program (they are only used for debugging)

This is a Bad Thing. The ASSERT statements are put in for a reason,
they document the assumptions inherent in the code. If those
assumptions are being broken then, sooner or later, so will the code.
As a rule, only delete ASSERT's if you have carefully verified that
they are, in fact, unnecessary. If you're talking about ASSERT's in
MFC itself, then the rule is just don't remove them.

Maranatha

Gordon Walker
(email: delete the leading and trailing 'a' and 'z'
from each part of the address and drop the
underscore)

Gordon Walker

unread,
Apr 7, 1998, 3:00:00 AM4/7/98
to

Jose Daniel Garcia Sanchez wrote:

>I have a program where I create several modeless dialog windows.
>
>When I call DestroyWindow, I get an assertion in
>
>File: Wincore.cpp
>Line: 900
>
>Has anybody an idea, why this can happen ?

I have no ASSERT code at line 900. What version VC are you running? If
you hit the debug button on the ASSERT dialog you can debug the
problem and give us more contextual information.

Jose Daniel Garcia Sanchez

unread,
Apr 7, 1998, 3:00:00 AM4/7/98
to

I have had a look to your hint but in this article there is nothing
about my problem.

Anyway, thank you very much!

Rajesh Parikh (MCSD) wrote:

> have a look at this article
> Foundation Classes Common Asserts, Causes and Solutions
> Article ID: Q117326
> http://support.microsoft.com/support/kb/articles/q117/3/26.asp
>
> --
> -------------------------------------------------------
> Rajesh Parikh
> Microsoft Certified Solution Developer
> rpa...@usa.net
> -------------------------------------------------------

--

Jose Daniel Garcia Sanchez

unread,
Apr 7, 1998, 3:00:00 AM4/7/98
to Gordon Walker
I am using Visual C++ v4.2

The assertion that fails is the first one

ASSERT (pMap != NULL).

Do you need any other information ?

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

 CHandleMap* pMap = afxMapHWND();
 ASSERT(pMap != NULL);
 CWnd* pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd);
#ifdef _DEBUG
 HWND hWndOrig = m_hWnd;
#endif

#ifdef _AFX_NO_OCC_SUPPORT
 BOOL bResult = ::DestroyWindow(m_hWnd);
#else //_AFX_NO_OCC_SUPPORT
 BOOL bResult;
 if (m_pCtrlSite == NULL)
  bResult = ::DestroyWindow(m_hWnd);
 else
  bResult = m_pCtrlSite->DestroyControl();
#endif //_AFX_NO_OCC_SUPPORT

 // Note that 'this' may have been deleted at this point,
 //  (but only if pWnd != NULL)
 if (pWnd != NULL)
 {
  // Should have been detached by OnNcDestroy
  ASSERT(pMap->LookupPermanent(hWndOrig) == NULL);
 }
 else
 {
  ASSERT(m_hWnd == hWndOrig);
  // Detach after DestroyWindow called just in case
  Detach();
 }
 return bResult;
}
 

--

Gordon Walker

unread,
Apr 8, 1998, 3:00:00 AM4/8/98
to

Jose Daniel Garcia Sanchez wrote:

>I am using Visual C++ v4.2
>
>The assertion that fails is the first one
>
>ASSERT (pMap != NULL).
>
>Do you need any other information ?

I need a brain upgrade <s>. I don't know what could cause this. It
appears to be the internal mapping that MFC maintains to link the
actual HWND's to its CWnd objects. The map looks like its gone. I can
only advise you to dig around in the MFC source for more information.
Paul DiLascia's C++ Q&A column from Microsoft Systems Journal Volume
12 Number 9 has a lot of good information on the topic. Its on MSDN
under this question: "In the June 1996 issue, you mentioned the
temporary/permanent handle map mechanism in MFC. When I tried to
browse though the source code about it, I just got confused. Could you
throw some light on this confusing topic?"

0 new messages