Solved

MFC  - debug assertion failed error

Posted on 2007-03-19
8
2,422 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
  • 4
  • 2
  • 2
8 Comments
 
LVL 68

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 68

Expert Comment

by:Qlemo
ID: 18754714
... the most important question, this is ...
0
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

744 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

12 Experts available now in Live!

Get 1:1 Help Now