Solved

MFC  - debug assertion failed error

Posted on 2007-03-19
8
2,553 Views
Last Modified: 2013-11-26
Hello,
My MFC project was working ok. I made a change to a line of code and it then started giving me a debug assertion failed error! It points to the ASSERT ( FALSE) line of  this funtion in dlgData.cpp
HWND CDataExchange::PrepareCtrl(int nIDC)
{
      ASSERT(nIDC != 0);
      ASSERT(nIDC != -1); // not allowed
      HWND hWndCtrl;
   COleControlSite* pSite = NULL;
      m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
      if (hWndCtrl == NULL)
      {
        // Could be a windowless OCX
        pSite = m_pDlgWnd->GetOleControlSite(nIDC);
        if (pSite == NULL)
        {
               TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC);
               ASSERT(FALSE);
               AfxThrowNotSupportedException();
        }
      }
      m_idLastControl = nIDC;
      m_bEditLastControl = FALSE; // not an edit item by default

   return hWndCtrl;
}


Does anyone know what would cause this error and what should I do to get rid of it!?

Thanks
-D
0
Comment
Question by:indacrypt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 70

Accepted Solution

by:
Qlemo earned 250 total points
ID: 18751574
The corresonding control is not existing (anymore), maybe you renamed the resource ID. This method is called when you create (or display?) your dialog, for all controls having a member variable assigned. All such controls are enumerated in DDX_... macros.
Have a look on the resource ID in this method, and what that correspnds to.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18754419
What was the line of code you changed?
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 18754714
... the most important question, this is ...
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 250 total points
ID: 18754736
Look at where the ASSERT(FALSE)  line is in the code - it *could* be something completely different to what your comment suggested.
0
 

Author Comment

by:indacrypt
ID: 18755573
Hi Andy...can u pls explain what you meant by "Look at where the ASSERT(FALSE)  line is in the code -"....Im not able to find that line anywhere in the code other than i nthe place pointed to b ythe debugger....
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18755591
comment meant for Qlemo.  His comment is likely to be correct but..

indacrypt - what line of code did you change?  Then we would know if Qlemo has got it right or not.
0
 

Author Comment

by:indacrypt
ID: 18755624
ok i see wht you meant....i followed the IDC number from the ASSERT line and found there are two controls by that number. I have to figureout which one hass the problem now I guess. Thanks!
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18755770
I don't think the resource editor will allow two controls with the same ID on the same dialog (apart from the special IDC_STATIC that is).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

710 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