Re: DoModal()
"hamishd" <Hamish.Dean@gmail.com> wrote in message
news:0c554795-1128-4696-bb12-3d0a5b85ddcb@a12g2000pro.googlegroups.com...
Hi, I'm calling a dialog via DoModal()...
OpenDataDlg Dlg;
if(Dlg.DoModal()==IDOK){
//do things here.. for example:
int Value = Dlg.m_Value;
}
My problem is once the Dlg exits I get an error on the line "int Value
= Dlg.m_Value;".
CDialog hWnd=0x00000000.
Why is my Dlg disappearing from memory?
One thing to note is, I accidentally deleted the IDOK button. So I re-
made a new one using the following steps:
1. Added a new button to the dialog
2. Set it to Default Button style
3. Gave it the ID of IDOK
This is normally fine. You should be able to access Dlg.m_Value after the
DoModal() completes. It's normal for CDialog::m_hwnd to be NULL after
DoModal() because the actual window has been destroyed (but the Dlg class
instance still exists, so you can still access Dlg.m_Value). What exactly
is the error?
-- David