我利用MFC Wizard 建立一个基于对话框的工程,建立之后去掉对话框类,然后建立一个自己的窗口类,
在我建立好之后,编译、连接之后,在运行时,窗口一闪而过,这是为什么?
请大师指点!!!该如何显示它?
在我建立好之后,编译、连接之后,在运行时,窗口一闪而过,这是为什么?
请大师指点!!!该如何显示它?
解决方案 »
- ActiveX控件在web中无法改变鼠标(光标)样式
- 我想问下关于GIF问题~~!!~
- mfc 视图文档 -程序设计的问题
- 请教有即时通讯软件开发经验的前辈们... 100分
- 建立了一个“IT圈程序员群”:),欢迎大家踊跃加入,技术、情感无所不谈:)
- 请问“SDK编程”和“C++编程”的区别???
- 98的进程管理不一样?
- 如何继承我自己创建的类?我用classwizard创建新类找不到我自己的类
- 哪有比较好的关于《深入浅出MFC 2e》的读书笔记
- 请问在ListCtrl里添加了图片,怎样保留checkbox
- 怎样把一个目录下的所有文件一次改名,处理超星之类文件?
- 检查Email地址是否法的算法是怎么样的呀?
基于对话框的工程,主窗口就是对话框,缺省是用DoModal调用对话框。DoModal会等到对话框退出后才继续向下执行。而你自己建立一个窗口,就相当于一个非模式对话框,当ShowWindow窗口后,程序是继续向下执行的,所以程序马上就结束了。
可以考虑作个循环,判断窗口中的某个变量为true才结束循环。而窗口类的这个变量只有当窗口关闭时才设置为true>
{
AfxEnableControlContainer();
AfxInitRichEdit();
// 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
//屏蔽原来的对话框
// CTest6Dlg dlg;
// m_pMainWnd = &dlg;
// int nResponse = dlg.DoModal(); CMyDlg 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;
}
C**Dlg dlg;
dlg.domodel();