Solved

ASSERTION ERROR

Posted on 2002-04-03
5
499 Views
Last Modified: 2012-06-27
Hi, I have a CDialog from which I open another CDialog. From the second Dialog I open an Open FileDialog I select the file to open.To this point everything works fine. However once the file dialog is closed I get an Assertion Error with respect to the following line in wincore.cpp

Line 628:  ASSERT(pWnd->m_hWnd == NULL);   // only do once

Although this is probably something small I can't see what is causing. Anyone have any Ideas...

Cheers...
Ber...
0
Comment
Question by:Ber
  • 3
5 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6916397
One way or another you're trying to access a window that no longer exists.  Stop doing it and the assertion will stop complaining.
0
 
LVL 2

Author Comment

by:Ber
ID: 6916440
If the window didn't exist then there would be no problem
because the assertion would evaluate to true
ie. if there were no window handle then it would be equal to NULL ASSERT(pWnd->m_hWnd == NULL);
So the window still exists...???

Ber...
0
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 6916576
What is the call stack when this ASSERT occurs? It seems that you are creating a window more than once...
0
 
LVL 2

Author Comment

by:Ber
ID: 6916597
Call Stack :

KERNEL32! bff768a0()
_CrtDbgReport(int 2, const char * 0x5f4cccf0 THIS_FILE, int 628, const char * 0x00000000, const char * 0x00000000) line 353
AfxAssertFailedLine(const char * 0x5f4cccf0 THIS_FILE, int 628) line 39 + 20 bytes
AfxHookWindowCreate(CWnd * 0x00781590 {CEdit hWnd=0x000009f8}) line 628 + 24 bytes
CWnd::CreateEx(unsigned long 0, const char * 0x5f4b095c ??_C@_04IGNI@EDIT?$AA@, const char * 0x00000000, unsigned long 1350631552, int 10, int 10, int 290, int 20, HWND__ * 0x00000340, HMENU__ * 0x00000001, void * 0x00000000) line 694
CWnd::Create(const char * 0x5f4b095c ??_C@_04IGNI@EDIT?$AA@, const char * 0x00000000, unsigned long 1350631552, const tagRECT & {top=10 bottom=30 left=10 right=300}, CWnd * 0x0065f438 {CLoadImage hWnd=???}, unsigned int 1, CCreateContext * 0x00000000) line 743
CEdit::Create(unsigned long 1350631552, const tagRECT & {top=10 bottom=30 left=10 right=300}, CWnd * 0x0065f438 {CLoadImage hWnd=???}, unsigned int 1) line 233
CLoadImage::OnPaint() line 69
CWnd::OnWndMsg(unsigned int 15, unsigned int 0, long 0, long * 0x0065a890) line 1825
CWnd::WindowProc(unsigned int 15, unsigned int 0, long 0) line 1585 + 30 bytes
AfxCallWndProc(CWnd * 0x0065f438 {CLoadImage hWnd=???}, HWND__ * 0x00000340, unsigned int 15, unsigned int 0, long 0) line 215 + 26 bytes
AfxWndProc(HWND__ * 0x00000340, unsigned int 15, unsigned int 0, long 0) line 368
AfxWndProcBase(HWND__ * 0x00000340, unsigned int 15, unsigned int 0, long 0) line 220 + 21 bytes
KERNEL32! bff7363b()
KERNEL32! bff94407()

Ber...
0
 
LVL 2

Author Comment

by:Ber
ID: 6916634
jkr got it in one ... I can't believe I didn't spot it

Cheers...
Ber...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now