Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem with DoDataExchange

Problem with DoDataExchange

Scheduled Pinned Locked Moved C / C++ / MFC
helpdata-structuresquestion
6 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Klecker
    wrote on last edited by
    #1

    void CProfessionClsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CProfessionClsDlg) DDX_Control(pDX, IDC_CATEGORIES, m_Categories); //crashes here DDX_Control(pDX, IDC_MAKEGROUPCHOICE, m_MakeGroupChoice); DDX_Control(pDX, IDC_LINKSKILLTODATABASE, m_LinkSkillToDatabase); ... //}}AFX_DATA_MAP } It seems that I have a problem with the DoDataExchange during the InitDialog procedure. The program will always crash, no matter how I stack the DDX_Control calls, on the very first call. This really doesn't make sense to me why it would be crashing and that it was working only a few days ago. I have other dialogs in the program that function like it and they work fine which makes me believe that the solution is a rather obscure and simple one. :confused: Thanks for the help. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

    T 1 Reply Last reply
    0
    • C Chris Klecker

      void CProfessionClsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CProfessionClsDlg) DDX_Control(pDX, IDC_CATEGORIES, m_Categories); //crashes here DDX_Control(pDX, IDC_MAKEGROUPCHOICE, m_MakeGroupChoice); DDX_Control(pDX, IDC_LINKSKILLTODATABASE, m_LinkSkillToDatabase); ... //}}AFX_DATA_MAP } It seems that I have a problem with the DoDataExchange during the InitDialog procedure. The program will always crash, no matter how I stack the DDX_Control calls, on the very first call. This really doesn't make sense to me why it would be crashing and that it was working only a few days ago. I have other dialogs in the program that function like it and they work fine which makes me believe that the solution is a rather obscure and simple one. :confused: Thanks for the help. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      You forgot to post the details of the crash - is it an ASSERT? GPF? The monitor explodes and all files on HD are deleted? Are you sure that control with id == IDC_CATEGORIES is defined in the dialog template? Tomasz Sowinski -- http://www.shooltz.com

      C 1 Reply Last reply
      0
      • T Tomasz Sowinski

        You forgot to post the details of the crash - is it an ASSERT? GPF? The monitor explodes and all files on HD are deleted? Are you sure that control with id == IDC_CATEGORIES is defined in the dialog template? Tomasz Sowinski -- http://www.shooltz.com

        C Offline
        C Offline
        Chris Klecker
        wrote on last edited by
        #3

        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);** AfxThrowNotSupportedException(); } m_hWndLastControl = hWndCtrl; m_bEditLastControl = FALSE; // not an edit item by default ASSERT(hWndCtrl != NULL); // never return NULL handle return hWndCtrl; } Actually, it's a bug that causes the dog to eat my homework. ;P It asserts out on the line I bolded above. I'm going to try and create a new dialog just for kicks and see if that dialog gives me problems. Thanks for the help. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

        T 1 Reply Last reply
        0
        • C Chris Klecker

          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);** AfxThrowNotSupportedException(); } m_hWndLastControl = hWndCtrl; m_bEditLastControl = FALSE; // not an edit item by default ASSERT(hWndCtrl != NULL); // never return NULL handle return hWndCtrl; } Actually, it's a bug that causes the dog to eat my homework. ;P It asserts out on the line I bolded above. I'm going to try and create a new dialog just for kicks and see if that dialog gives me problems. Thanks for the help. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

          T Offline
          T Offline
          Tomasz Sowinski
          wrote on last edited by
          #4

          Check nIDC passed to PrepareControl - you may have some #define conflict and symbol that you're using in DDX_Control resolves to number other than used in dialog template resource. Tomasz Sowinski -- http://www.shooltz.com

          C 1 Reply Last reply
          0
          • T Tomasz Sowinski

            Check nIDC passed to PrepareControl - you may have some #define conflict and symbol that you're using in DDX_Control resolves to number other than used in dialog template resource. Tomasz Sowinski -- http://www.shooltz.com

            C Offline
            C Offline
            Chris Klecker
            wrote on last edited by
            #5

            With a program which has a few DLL projects and one EXE project is it okay to have #define values that are the same between the DLL's and EXE. For example one DLL project has a value for 1000 while another DLL has a value for a 1000, however both are different ID's. Is it wise to make all #defines in a project different regardless? Thanks again. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

            T 1 Reply Last reply
            0
            • C Chris Klecker

              With a program which has a few DLL projects and one EXE project is it okay to have #define values that are the same between the DLL's and EXE. For example one DLL project has a value for 1000 while another DLL has a value for a 1000, however both are different ID's. Is it wise to make all #defines in a project different regardless? Thanks again. "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

              T Offline
              T Offline
              Tomasz Sowinski
              wrote on last edited by
              #6

              Yes, especially if you plan to create context help someday :) This also applies to duplicated values mapped to different IDC_xxx inside single DLL or EXE. Tomasz Sowinski -- http://www.shooltz.com

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups