Problem with DoDataExchange
-
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." -
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."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
-
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
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." -
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."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
-
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
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."
-
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."
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