Debug Assertion in CDialog::DoModal
-
I am getting a debug assertion that I havn't ever seen before, and I cant figure it out.:confused: If anybody has any ideas pls let me know. Thanks Here is the constructor dec: CModemInterface(CStringArray* out, CWnd* pParent = NULL); And here is where I call the dialog: CStringArray* testFiles = new CStringArray(); for(int i = 0; i < 5; i++) { CString strTemp; strTemp.Format("Test%i.txt", (i + 1)); testFiles->Add(strTemp); } CModemInterface dlg(testFiles, this); if(dlg.DoModal() == IDOK) //crash here, traced into CDialog::DoModal delete testFiles; return; :confused:
-
I am getting a debug assertion that I havn't ever seen before, and I cant figure it out.:confused: If anybody has any ideas pls let me know. Thanks Here is the constructor dec: CModemInterface(CStringArray* out, CWnd* pParent = NULL); And here is where I call the dialog: CStringArray* testFiles = new CStringArray(); for(int i = 0; i < 5; i++) { CString strTemp; strTemp.Format("Test%i.txt", (i + 1)); testFiles->Add(strTemp); } CModemInterface dlg(testFiles, this); if(dlg.DoModal() == IDOK) //crash here, traced into CDialog::DoModal delete testFiles; return; :confused:
What kind of assertion do you get? Does it crash in OnInitDialog? Best regards, Alexandru Savescu
-
What kind of assertion do you get? Does it crash in OnInitDialog? Best regards, Alexandru Savescu
In dlgcore.cpp, function CDialog::DoModal(): // can be constructed with a resource template or InitModalIndirect ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL || m_lpDialogTemplate != NULL); //Fails here this is the first line of the function. any thoughts?? thanks
-
In dlgcore.cpp, function CDialog::DoModal(): // can be constructed with a resource template or InitModalIndirect ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL || m_lpDialogTemplate != NULL); //Fails here this is the first line of the function. any thoughts?? thanks
When you wrote the CModemInterface class constructor, did you remember to call the default CDialog constructor, passing along the dialog template Id?
CModemInterface::CModemInterface (CStringArray *s, CWnd *pWnd)
: CDialog (CModemInterface::IDD, pWnd)
{
// whatever
}--- CPUA 0x5041 Sonork 100.11743 Chicken Little Orgasms are universal!! :omg: -- Mike Mullikin in The Lounge 21:27 15 May '02