Gurus,

My main dialog creates a modal dialog which in turn creates another modal dialog when the user click on a button.

/////////////////////////////
// Main Dialog //
////////////////////////////
||
///////////////////////////
// Modal DLG 1 //
//////////////////////////
||
///////////////////////////
// Modal DLG 2 //
//////////////////////////

Code:
void CMyModalDlg1::OnBnClick()
{
    CMyModalDlg2 ModalDlg2();
    INT_PTR iResult = ModalDlg2.DoModal();
   ....
}
How can I close BOTH created modals from my main dialog ??

I've tried:

Code:
void CModalDlg1::CloseDialog()
{
     EndDialog( 0 );
}


void CMainDlg::CloseBothDialogs()
{
    if ( m_pModalDlg1 )
        m_pModalDlg1->CModalDlg1();
}
ModalDlg1 is closed after calling CloseBothDialog() but it ModalDlg2 was created by Modal1, the dialog will not terminate.

Any advice??

Many thanks!!!