|
-
January 7th, 2008, 05:53 PM
#1
_ASSERT not working
I am working with an application that I initially started as a MFC dialog based app. Adding the line _ASSERT(false); works as expected in most parts of the code, but if it's anywhere after the main dialog is closed, then the program shuts down as if the Abort button was pushed on the assert dialog window. For example, if I put _ASSERT(false); at the top of ExitInstance, I will not see the assert dialog at all (but sometimes I hear the windows error sound), and nothing below that line of code will execute. This caused me a lot of trouble trying to track down a bug. I use _ASSERT in a lot of my code, so I would like it to work as it does normally (halt the code, and give me a dialog to choose what to do). How can I fix this?
-
January 8th, 2008, 04:12 AM
#2
Re: _ASSERT not working
You can try AfxDebugBreak () instead of _ASSERT(false).
-
January 8th, 2008, 10:51 AM
#3
Re: _ASSERT not working
_ASSERT[E] is from CRT Library. It may have problem detecting the "main" window of MFC-application and making it dialog's parent.
Use ASSERT. ASSERT macro calls AfxDebugBreak.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|