problem in showing and hiding dialog boxes in MFC

Posted by Rakesh on Stack Overflow See other posts from Stack Overflow or by Rakesh
Published on 2010-03-20T08:42:34Z Indexed on 2010/03/20 8:51 UTC
Read the original article Hit count: 280

Filed under:
|

Hello all, I am trying to create a wizard like structure using dialog boxes...So I replaced the code in CDialog1App as below

CDialog1Dlg* dlg = new CDialog1Dlg;
m_pMainWnd = dlg;
dlg->Create(IDD_DIALOG1);
dlg->ShowWindow(SW_SHOW);

the above worked fine...its displying the dialog box.but I have added another dialog box... So in the first dialog box if the user clicks Next it has to hide the first dialog box and display the second dialog..

//CDialog1 class

void CDialog1Dlg::OnBnClickedNext()
{
    // TODO: Add your control notification handler code here
    CDialog2* dialog2 = new CDialog2();
    dialog2->Create(IDD_DIALOG2);
    dialog2->ShowWindow(SW_SHOW);
    this->ShowWindow(SW_HIDE);
}

in the above code am creating an object for the Dialog2 class and trying to show that.... Now the problem is,when I click next its hiding both the windows..What can I do..I tried several types but its still its not workin..Please dont suggest me to do with PropertySheet..It will work with that, i know ...but I want this using Dialog Box for some reason

© Stack Overflow or respective owner

Related posts about dialogbox

Related posts about mfc