Advertisement Jump to content
Sign in to follow this  
zongwentao

MFC help!

This topic is 4909 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, all I am programing a form based application using MFC. SDI without doc/view. I defined several CDialog Classes as public members of Childview. and I created these dialogs in mainfrm::oncreate() and showed the first one dialog (whose name is CstrtupDialog). what I want the app to be is when the user click one button (whose name is new) on the first dialog, shows another dialog. I think this should be done in the function CstartupDialog::OnBnClickednew(). But I don't know how to immplement it. How to get the pointer/handle to ChildView? Assuming the second dialog class is CSeconddialog, anyone can give me some advice on it? Your reply is appreciated! Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
If you are popping up a modal dialog box when the user clicks a button, you can call the dialog boxes DoModal() function. If you are popping up a modeless, you will need to use the dialog boxes Create function.


void CstartupDialog::OnBnClickednew()
{
//to pop up a modal dialog box
CSeconddialog dlgModal;
dlgSecondDialog.DoModal();

//to create a new modeless dialog box
//should store this pointer somewhere
CSeconddialog *pdlgModeless = new CSeconddialog;
pdlgModeless->Create(IDD_SECONDDIALOG, this);
}


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!