CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2019
    Posts
    82

    Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    I have a CDialog , i decleared the Combobox in .rc file , i can see that combobox on screen but as soon as i do DDX mapping of this combobox , dialog dont open and produces asseetion failed. I have added other combobox in same dialog but addidtion of this combobox produces above mentioned problem.Sample code are below:

    Code:
    // Mydialog.h
    CComboBox  combo_one ;
    CComboBox  combo_two;
    CComboBox  combo_three;
    CComboBox  combo_four;
    //MyDialog.cpp
    Code:
    void MyDialog :: DoDataExchange(CDataExchange* pDX)
    {
    DDX_Control(pDX, IDC_COMBO_ONE, combo_one);
    DDX_Control(pDX, IDC_COMBO_TWO, combo_two);
    DDX_Control(pDX, IDC_COMBO_THREE, combo_three);
    DDX_Control(pDX, IDC_COMBO_FOUR, combo_four);
    }
    //Mydialog.rc
    Code:
    COMBOBOX   IDC_COMBO_ONE, 10.,20,30,40, CBS_DROPDOWN
    COMBOBOX   IDC_COMBO_TWO, 20.,30,30,40, CBS_DROPDOWN
    COMBOBOX   IDC_COMBO_THREE, 30.,40,30,40, CBS_DROPDOWN
    COMBOBOX   IDC_COMBO_FOUR,40,50,30,40, CBS_DROPDOWN
    i am getting no error when i added and mapped IDC_COMBO_ONE, IDC_COMBO_TWO,IDC_COMBO_THREE but as soon as i mapped IDC_COMBO_FOUR in DoDataExchange , error of assertion failed comes.
    I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    What is tue resource ID of IDC_COMBO_FOUR ? Does it conflict with other resource IDs?

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    Quote Originally Posted by Beginner_MFC View Post
    ... as soon as i mapped MBO_FOUR in DoDataExchange , error of assertion failed comes.
    I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.
    Where exactly "assertion failed" happens?
    Victor Nijegorodov

  4. #4
    Join Date
    Oct 2019
    Posts
    82

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    No its unique it doesn't conflict with other resource id.

  5. #5
    Join Date
    Oct 2019
    Posts
    82

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    It fails at line DDX_CONTROL(pDX, IDC_COMBO_FOUR, combo_four.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    Is the IDC_COMBO_FOUR associated with a combobox?
    Does this combobox belong to your dialog?
    Victor Nijegorodov

  7. #7
    Join Date
    Oct 2019
    Posts
    82

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    Yes it belongs to combobox and combobox belongs to MyDialog

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    Could you post your project? (in .zip archive, without debug. release, .vs folders)
    Victor Nijegorodov

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Ccombox mapping in DoDataExchange(CDataExchange* pdx) giving assertion failed

    Quote Originally Posted by Beginner_MFC View Post
    error of assertion failed comes.
    What text (exactly!) do you see?

    Quote Originally Posted by Beginner_MFC View Post
    I debugged and found that when i hover combo_four variable during debug its hwnd is null while other three varaible have some memory.
    Sure it is NULL! just because this control has not been subclassed yet!

    So how about sending the test project?
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured