我定义了一个MFC基于对话框的工程并自行增加了不少对话框,问题是这些对话框
中哪个是主对话框?也就是说我想其中的一个对话框在我运行该工程时首先出现,
请问该在哪里添加代码以指明启动对话框?请赐教!
中哪个是主对话框?也就是说我想其中的一个对话框在我运行该工程时首先出现,
请问该在哪里添加代码以指明启动对话框?请赐教!
解决方案 »
- 求助: 如何识别LED 7段码图片上的数字?
- TreeView控件
- CFile WriteHugevc2005不支持这个函数
- 完成端口,到底一个CPU 建几个线程?为什么有些资料上说是一个,另一些又说是两个呢?
- pDC指针如何理解?
- 有没有第三方的串口类,接收数据不是用消息或者类似于MSComm控件的CSCommTestDlg::OnComm()
- 能不能在程序第一次启动时由程序自动检测是否已安装相应的ODBC驱动,如没有则安装相应的驱动!
- 怎样将CEdit控件封装成自己的控件?
- 完成端口问题!!
- 100分问一个简单问题:我程序中用msword9.olb,但机器上装msword8.olb是否有版本冲突,如有如何解决?
- 丢了DSW文件,怎么办?
- 怎么能取得Word的当前文档的路径?
{
AfxEnableControlContainer(); // Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif CTreeDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
} // Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
注意:
CTreeDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
这三行便显示的是主对话框,
以上代码都是模板自动生成的
其它的对话框一定需要你调用才能够出现。
其它的对话框一定需要你调用才能够出现。
/*********************************************************************************/
注意:
CTreeDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
/*********************************************************************************/
同意以上两段。
框,其它的对话框一定要你调用它才能够出现.
然后,把这行:
CTreeDlg dlg;
改为:
CMyDlg dlg;
再包含进相应的头文件:
#include "MyDlg.h"
就可以了。
我试验过了,没问题。