Click here to Skip to main content
12,623,511 members (34,115 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: MFC dialog
How can I create current CDailog in class MainWnd: public CFrameWnd ?
Can't you give an code exaple.

Thanks.
Posted 11-Apr-12 8:03am
Comments
Darryl Bryk 6-Jun-12 12:01pm
   
Are you trying to open a dialog window like MessageBox?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I'm not pretty sure what you're talking about here, but if you just want to display a modal (that is, the user can only interact with the dialog) dialog that has your main frame as a parent, it's really easy.
What I like to do, is to derive a class from CDialog like this:
class CMyDialog : public CDialog
{
   /* CDialog declarations here */
};
Then I map it to a dialog resource. The best way to create this class is by using the MFC class wizard. First create the dialog resource and then create the MFC class using the wizard. Set the Base Class to CDialog and the ID to your dialog's ID (e.g. IDD_MYDIALOG). Then instantiate the class and call the DoModal() function.
CMyDialog* pDialog = new CMyDialog();
pDialog->DoModal();
That's all.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 3 Jul 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100