Thread: program throws assert after deleting a resource

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    114

    program throws assert after deleting a resource

    program throws assert after deleting a resource

    after i added some editbox in my dialog and did a few compiles, i decided to remove some of the editboxes and change my GUI. but all of a sudden the program throws assertions errors after compilation

    checking the call stack, it traces up to this

    Code:
    HWND CDataExchange::PrepareCtrl(int nIDC)
    {
    	ASSERT(nIDC != 0);
    	ASSERT(nIDC != -1); // not allowed
    	HWND hWndCtrl;
    	m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
    	if (hWndCtrl == NULL)
    	{
    		TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
    		ASSERT(FALSE);   <THIS IS THE PLACE WHERE IT ASSERTS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!>
    		AfxThrowNotSupportedException();
    	}
    	m_hWndLastControl = hWndCtrl;
    	m_bEditLastControl = FALSE; // not an edit item by default
    	ASSERT(hWndCtrl != NULL);   // never return NULL handle
    	return hWndCtrl;
    }
    sorry i am new to programming



    using
    mfc style
    winxp
    vc6.0++

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    I would guess that the function tries to retrieve the handle of one of the controls that you removed. What ID does it assert on? And what were the IDs of the controls that you removed?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    Quote Originally Posted by JaWiB View Post
    I would guess that the function tries to retrieve the handle of one of the controls that you removed. What ID does it assert on? And what were the IDs of the controls that you removed?
    thnx for the help, i someone suggested the following and i am working on it

    1. First check the DoDataExchange(CDataExchange* pDX) function in your Dlg.cpp. It should not have any instances of your edit boxes / Controls

    2. In your dlg.h file . make sure still there are any handles which is not deleted.

    3. your .rc / resource.h may have the Ids of it still.

    if any of the above things are there, Delete those things manually

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>1. First check the DoDataExchange(CDataExchange* pDX) function in your Dlg.cpp. It should not have any instances of your edit boxes / Controls<<

    This is most likely your problem.

    >>3. your .rc / resource.h may have the Ids of it still.<<

    This won't make a difference.


    Also.....

    Check that you don't have anything handlers, for the deleted controls, under

    BEGIN_MESSAGE_MAP

    ie
    ON_EN_CHANGE() handlers
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CreateProcess with Resource of executable, not the Filename
    By Ktulu in forum Windows Programming
    Replies: 4
    Last Post: 11-04-2006, 01:07 AM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM