I'm writing an MFC application that uses modal dialog boxes exclusively. It uses a database and gives the user a restricted email client. The issue pertains to a couple of dialog boxes each with their own class: CTriggerDlg and CSavedDlg. In CTriggerDlg there's a function that calls the CSavedDlg dialog box,
void CTriggerDlg::OnView()
{
CSavedDlg dlg;
dlg.DoModal();
}
From the CSavedDlg dialog a selection from a list box determines what email you will view. And then calls a function out of CTriggerDlg that loads the message into the mail dialog via the LoadMsg() function.
void CSavedDlg::OnLoad()
{
CString szChoice;
int nChoice = m_listSMsg.GetCurSel();
m_listSMsg.GetText( nChoice, szChoice );
int Mark = szChoice.Find(':');
SavedId = szChoice.Left( Mark );
CSavedDlg::EndDialog(1);
CTriggerDlg dlg;
dlg.LoadMsg();
}
Everything works up until it actually tries to change the text on the CTriggerDlg dialog. I get an assert error in winocc.cpp during runtime.
I'm not very familiar with building MFC apps and I may have totally gone about this the wrong way. But either way, I'd like to know why I can change anything on the CTriggerDlg dialog all day long, but as soon as the CSavedDlg dialog is opened and closed
( eg. CSavedDlg::EndDialog(1) )
I can't change anything on the CTriggerDlg?
Is it because I've lost the handle to the CTriggerDlg dialog when the CSavedDlg opened up? Thanks
void CTriggerDlg::OnView()
{
CSavedDlg dlg;
dlg.DoModal();
}
From the CSavedDlg dialog a selection from a list box determines what email you will view. And then calls a function out of CTriggerDlg that loads the message into the mail dialog via the LoadMsg() function.
void CSavedDlg::OnLoad()
{
CString szChoice;
int nChoice = m_listSMsg.GetCurSel();
m_listSMsg.GetText( nChoice, szChoice );
int Mark = szChoice.Find(':');
SavedId = szChoice.Left( Mark );
CSavedDlg::EndDialog(1);
CTriggerDlg dlg;
dlg.LoadMsg();
}
Everything works up until it actually tries to change the text on the CTriggerDlg dialog. I get an assert error in winocc.cpp during runtime.
I'm not very familiar with building MFC apps and I may have totally gone about this the wrong way. But either way, I'd like to know why I can change anything on the CTriggerDlg dialog all day long, but as soon as the CSavedDlg dialog is opened and closed
( eg. CSavedDlg::EndDialog(1) )
I can't change anything on the CTriggerDlg?
Is it because I've lost the handle to the CTriggerDlg dialog when the CSavedDlg opened up? Thanks