模态对话框已关闭。 [英] Modal Dialog getting Closed.

查看:71
本文介绍了模态对话框已关闭。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在MFC中创建了一个模态和无模式对话项目。



无模式对话框,它具有属性,它将获得15秒后关闭,关闭Modelss对话框我正在使用DestroyWindow()。



现在问题在于模态对话框,

1)如果我们打开无模式对话框(它将在15秒后自动关闭)。



2)如果我们打开模态对话框,那么在关闭模式对话框之后,在​​15秒之后,模态和无模态对话框正在关闭,应用程序geting崩溃。



3)我认为DestroyWindow()正在关闭对话框。



请帮帮我....如何解决这个问题。

Hi,
I have created one project of Modal and Modeless Dialog in MFC.

Modeless Dialog having property that it will get closed after 15 second, for closing Modelss dialog i am using DestroyWindow().

Now Problem is with Modal Dialog,
1)If we open Modeless Dialog(which will automatically gets close after 15 second).

2)Before closing Modeless Dialog if we open Modal Dialog then after 15 second both Modal & Modeless Dialogs are getting closed and Application geting crashed.

3)I think DestroyWindow() is closing both Dialog.

Please Help me....How to solve this problem.

推荐答案

如果从GUI线程以外的线程调用DestroyWindow,它将创建访问冲突。

请确保从GUI线程调用DestroyWindow。

一个选项是将WM_CLOSE消息发送到对话框(使用PostMe) ssage),

并关闭ModelLessDlg :: OnClose()中的所有其他对话框。
If you calling DestroyWindow from a thread other than GUI thread, it will create access violation.
Please ensure DestroyWindow is called from GUI thread.
One option is to Post WM_CLOSE Message to your dialog(Using PostMessage),
and close all other dialogs from ModelLessDlg::OnClose().


这篇关于模态对话框已关闭。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆