Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFCdialog
How can I create current CDailog in class MainWnd: public CFrameWnd ?
Can't you give an code exaple.
 
Thanks.
Posted 11-Apr-12 7:03am
Comments
Darryl Bryk at 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
0 Dnyaneshwar@Pune 1,300
1 Sergey Alexandrovich Kryukov 802
2 Tadit Dash 330
3 ravikhoda 300
4 OriginalGriff 272
0 Sergey Alexandrovich Kryukov 11,441
1 OriginalGriff 6,930
2 Peter Leow 4,850
3 Abhinav S 3,838
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 3 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid