问题描述
我的项目是基于对话框的MFC项目.我的父对话框的类名是CdialogchangDlg,我的子对话框的类名是CPicture2和CPicture3.我可以访问我的子对话框.现在,我想从一个子对话框转到另一个子对话框,我使用按钮来执行此操作.
代码是:
My project is a MFC project based on dialogs. The class name of my parent dialog is CdialogchangDlg and my child dialogs are CPicture2 and CPicture3. I can access my child dialogs. Now I want to go to another child dialog from one child dialog, I use buttons to do this.
The code is:
void CPicture2::OnBnClickedButton1()
{
CPicture3 pic3;
OnOK();
pic3.DoModal();
}
和
and
void CPicture3::OnBnClickedButton1()
{
CPicture2 pic2;
OnOK();
pic2.DoModal();
}
该程序运行没有问题.但是,当我单击按钮约300次以在两个子对话框之间切换对话框时,该程序已死.当我单击按钮时,我发现分配给程序的内部存储器会无休止地增加,直到程序死了.有人说,当我使用DoModal()
时,当前对话框并没有真正被销毁.真的吗?我该如何解决这个问题?
我是新生,谢谢.
The program runs without problems. But when I click the button about 300 times to change dialog box between the two child dialogs the program is dead. When I click the button, I find the internal memory gave to the program go up with no stop until the program is dead. Some people said when I use DoModal()
the current dialog is not really destroyed. Is that true? And how could I resolve this problem?
I am a freshman, thank you.
推荐答案
这篇关于显示模态子对话框时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!