Click here to Skip to main content
15,905,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Print CRichEditCtrl from CView Pin
jschacker6-Sep-00 13:00
jschacker6-Sep-00 13:00 
GeneralPrint Information Pin
David Pokluda3-Sep-00 8:08
David Pokluda3-Sep-00 8:08 
QuestionHow to get a CWnd background color Pin
zhiying3-Sep-00 5:07
susszhiying3-Sep-00 5:07 
AnswerRe: How to get a CWnd background color Pin
Tim Deveaux3-Sep-00 15:14
Tim Deveaux3-Sep-00 15:14 
QuestionHow to get a CWnd background color Pin
zhiying3-Sep-00 5:07
susszhiying3-Sep-00 5:07 
QuestionHow to get a CWnd background color Pin
zhiying3-Sep-00 5:07
susszhiying3-Sep-00 5:07 
QuestionWhat's a debug assertion ??? Pin
P0lO3-Sep-00 4:47
P0lO3-Sep-00 4:47 
AnswerRe: What's a debug assertion ??? Pin
Tim Deveaux3-Sep-00 7:43
Tim Deveaux3-Sep-00 7:43 
assertions are a good thing!

They are placed in code by the programmer to verify that something is true, and if it isn't true, force (when DEBUG is defined) the display of a nasty message like the one you describe.

You are getting this assertion from an MFC app (via the ASSERT() macro) but the standard library assert() is available as well for non MFC apps.

MFC code uses ASSERTs liberally - as it should. Very often you'll see code that does something like ASSERT(pointer != NULL). If the expression is true, the code continues - but if not (i.e. a NULL pointer) the code will 'assert'. The idea is that its better to see the fault here than to track a subsequent access violation (which may end up in a system DLL).

Note that you have to be careful not to put code with side effects inside an ASSERT - because it won't be compiled for a release build - MFC provides the VERIFY macro if you want to do the equivalent of an assert in a release build.

Philosophies vary on what constitutes a valid place for an assertion. Some say they should be reserved for critical things like NULL pointers that will generally cause a crash. I tend to use them for even minor things that may not be critical but I want to know about them - things that I might miss if I just TRACE a notification to the debug output window.

The ASSERT you are getting comes from CDataExchange - probably some problem with a dialog control ID. What you can do is choose Retry to invoke the debugger, then press Alt+7 to display the call stack. (Or View | Debug Windows | etc.) By looking at the ASSERT statement and the surrounding code, you should be able to identify some offending variable or resource define. You'll often need the call stack to backtrack to the source of the problem, but unless its some nasty mess in your resouce file you should be able to figure it out.



GeneralRe: What's a debug assertion ??? Pin
P0lO4-Sep-00 7:58
P0lO4-Sep-00 7:58 
GeneralRe: What's a debug assertion ??? Pin
Member 12089654-Sep-00 10:34
Member 12089654-Sep-00 10:34 
GeneralCDialogBar in CView Pin
Erik3-Sep-00 0:06
Erik3-Sep-00 0:06 
GeneralRe: CDialogBar in CView Pin
jschacker5-Sep-00 4:56
jschacker5-Sep-00 4:56 
GeneralRe: CDialogBar in CView Pin
Erik5-Sep-00 6:07
Erik5-Sep-00 6:07 
GeneralRe: CDialogBar in CView Pin
jschacker5-Sep-00 7:07
jschacker5-Sep-00 7:07 
GeneralLoadImage not loading animated cursor from resources when statically linking to MFC Pin
Paolo Messina2-Sep-00 23:48
professionalPaolo Messina2-Sep-00 23:48 
GeneralRe: LoadImage not loading animated cursor from resources when statically linking to MFC Pin
Michael Dunn3-Sep-00 8:28
sitebuilderMichael Dunn3-Sep-00 8:28 
GeneralRe: LoadImage not loading animated cursor from ... Pin
Paolo Messina3-Sep-00 21:34
professionalPaolo Messina3-Sep-00 21:34 
GeneralRe: Display raw data images Pin
Feng Yuan4-Sep-00 19:30
Feng Yuan4-Sep-00 19:30 
GeneralRe: LoadImage, LoadCursor *BUG* Pin
Paolo Messina4-Sep-00 0:12
professionalPaolo Messina4-Sep-00 0:12 
GeneralI'm near to become crazy... Pin
Paolo Messina4-Sep-00 7:41
professionalPaolo Messina4-Sep-00 7:41 
GeneralProblem while using windows hook and open file handle Pin
Chris Utz2-Sep-00 6:02
sussChris Utz2-Sep-00 6:02 
QuestionMDI app without MFC? Pin
B2-Sep-00 3:52
B2-Sep-00 3:52 
AnswerRe: MDI app without MFC? Pin
jschacker5-Sep-00 5:17
jschacker5-Sep-00 5:17 
AnswerRe: MDI app without MFC? Pin
Sam Hobbs7-Sep-00 18:49
Sam Hobbs7-Sep-00 18:49 
AnswerRe: MDI app without MFC? Pin
Scott Leonard8-Sep-00 5:00
Scott Leonard8-Sep-00 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.