How to create a form or dailog in MFC-MDI ?
-
In MFC-MDI, I create Dailog in MFC-MDI Maiframe, but tell me is error. In MFC-Dailog, create Dailog is No problem ; Help Help Help ;
-
In MFC-MDI, I create Dailog in MFC-MDI Maiframe, but tell me is error. In MFC-Dailog, create Dailog is No problem ; Help Help Help ;
Please post the (relevant) code. Please post the error message. Please read the forum guidelines. Please... :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
In MFC-MDI, I create Dailog in MFC-MDI Maiframe, but tell me is error. In MFC-Dailog, create Dailog is No problem ; Help Help Help ;
I find error because I Create AboutDailog and i show this dailog; but AboutDailog code same of system create CAboutDlg : ----------AboutDailog.h--------------------- class AboutDailog : public CDialog { DECLARE_DYNAMIC(AboutDailog) public: AboutDailog(); virtual ~AboutDailog(); protected: DECLARE_MESSAGE_MAP() public: afx_msg void OnFileAbout(); }; ----------AboutDailog.cpp--------------------- // AboutDailog.cpp : 实现文件 // #include "stdafx.h" #include "MyControlTest.h" #include "AboutDailog.h" // AboutDailog IMPLEMENT_DYNAMIC(AboutDailog, CWnd) AboutDailog::AboutDailog() { } AboutDailog::~AboutDailog() { } BEGIN_MESSAGE_MAP(AboutDailog, CWnd) ON_COMMAND(ID_FILE_ABOUT, &AboutDailog::OnFileAbout) END_MESSAGE_MAP() // AboutDailog 消息处理程序 void AboutDailog::OnFileAbout() { // TODO: 在此添加命令处理程序代码 AboutDailog aboutDlg; aboutDlg.DoModal(); } ----------CAboutDlg.h--------------------- class CAboutDlg : public CDialog { public: CAboutDlg(); // 对话框数据 enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: DECLARE_MESSAGE_MAP() }; ----------CAboutDlg.cpp--------------------- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) END_MESSAGE_MAP() // 用于运行对话框的应用程序命令 void CMyControlTestApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); /*AboutDailog aboutDlg; aboutDlg.DoModal();*/ }
-
I find error because I Create AboutDailog and i show this dailog; but AboutDailog code same of system create CAboutDlg : ----------AboutDailog.h--------------------- class AboutDailog : public CDialog { DECLARE_DYNAMIC(AboutDailog) public: AboutDailog(); virtual ~AboutDailog(); protected: DECLARE_MESSAGE_MAP() public: afx_msg void OnFileAbout(); }; ----------AboutDailog.cpp--------------------- // AboutDailog.cpp : 实现文件 // #include "stdafx.h" #include "MyControlTest.h" #include "AboutDailog.h" // AboutDailog IMPLEMENT_DYNAMIC(AboutDailog, CWnd) AboutDailog::AboutDailog() { } AboutDailog::~AboutDailog() { } BEGIN_MESSAGE_MAP(AboutDailog, CWnd) ON_COMMAND(ID_FILE_ABOUT, &AboutDailog::OnFileAbout) END_MESSAGE_MAP() // AboutDailog 消息处理程序 void AboutDailog::OnFileAbout() { // TODO: 在此添加命令处理程序代码 AboutDailog aboutDlg; aboutDlg.DoModal(); } ----------CAboutDlg.h--------------------- class CAboutDlg : public CDialog { public: CAboutDlg(); // 对话框数据 enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: DECLARE_MESSAGE_MAP() }; ----------CAboutDlg.cpp--------------------- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) END_MESSAGE_MAP() // 用于运行对话框的应用程序命令 void CMyControlTestApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); /*AboutDailog aboutDlg; aboutDlg.DoModal();*/ }
Patrick Tang wrote:
but AboutDailog code same of system create CAboutDlg
One constructor does not use any resource template ID... :)
Check your definition of Irrationality[^] :) 1 - Avicenna 5 - Hubbard 3 - Own definition
-
In MFC-MDI, I create Dailog in MFC-MDI Maiframe, but tell me is error. In MFC-Dailog, create Dailog is No problem ; Help Help Help ;
Patrick Tang wrote:
...but tell me is error.
Are you keeping this error a secret or can you be bothered to share it with us?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius