By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,173 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

MFC code problem please help

100+
P: 100
hi,
Expand|Select|Wrap|Line Numbers
  1. #include <afxwin.h>
  2.  
  3. class CExerciseApp : public CWinApp
  4. {
  5. public:
  6.     virtual BOOL InitInstance();
  7. };
  8.  
  9.  
  10.  
  11.  
  12. BOOL CExerciseApp::InitInstance()
  13. {
  14.     CDialog init;
  15.     init.Create(IDD_DIALOG1);
  16.     m_pMainWnd = new CMainFrame;
  17.     m_pMainWnd->ShowWindow(SW_NORMAL);
  18.  
  19.     return TRUE;
  20. }
  21.  
  22. CExerciseApp theApp;
  23.  
HEre is my code i just want to create a Dialog box...How?...pls help
Jun 14 '07 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
Time to read "Programming Windows with MFC" by Jeff Prosise.

If memory serves, I think you need to call DoModal to display your box.
Jun 14 '07 #2

P: 15
Assuming that you have created your dialog layout and plugged in the controls you want, you must show it.

1) Modal dialog box: by calling CDialog::DoModal, you leave the control of the application to that sole window, until you close it. It becomes the only window to capture events
2) Modeless dialog: you simply call CDialog::ShowWindow (CWnd::ShowWindow); you can pop up other dialogs around and they will be all elligible to receive inputs.

Hope this helps

hi,
Expand|Select|Wrap|Line Numbers
  1. #include <afxwin.h>
  2.  
  3. class CExerciseApp : public CWinApp
  4. {
  5. public:
  6.     virtual BOOL InitInstance();
  7. };
  8.  
  9.  
  10.  
  11.  
  12. BOOL CExerciseApp::InitInstance()
  13. {
  14.     CDialog init;
  15.     init.Create(IDD_DIALOG1);
  16.     m_pMainWnd = new CMainFrame;
  17.     m_pMainWnd->ShowWindow(SW_NORMAL);
  18.  
  19.     return TRUE;
  20. }
  21.  
  22. CExerciseApp theApp;
  23.  
HEre is my code i just want to create a Dialog box...How?...pls help
Jun 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.