Quote Originally Posted by ajbharani View Post
Something like this
Code:
void CDialog1::OnButton1() 
{
    CDialog2 *dia2 = new CDialog2();    
    dia2->Create(IDD_DIALOG2);
    dia2->ShowWindow(SW_SHOW);
}
No, not like that, if you don't want to leak memory. Make the pointer to the dialog a member of the class.
Code:
class CDialog1
{
  CDialog2 *m_dia2;
};

CDialog1::CDialog1()
{
   m_dia2 = NULL;
}

void CDialog1::OnButton1() 
{
    if(m_dia2 == NULL) 
        m_dia2 = new CDialog2();

    if(!m_dia2->Create(IDD_DIALOG2))
    {
        delete m_dia2;
        m_dia2 = NULL;

        // show error
    }

    m_dia2->ShowWindow(SW_SHOW); // or perhaps first call SW_SHOW and second call SW_HIDE
}