Solved

MFC  - debug assertion failed error

Posted on 2007-03-19
8
2,485 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 69

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 69

Expert Comment

by:Qlemo
ID: 18754714
... the most important question, this is ...
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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