MFC Parent&儿童对话 - 像多线程 [英] MFC Parent & Child Dialog- Like multithreaded

查看:83
本文介绍了MFC Parent&儿童对话 - 像多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在下面的情景中需要一些帮助:



我创建了MFC C ++中Visual Studio 2010中基于对话框的应用程序。我的主对话框是模态的,我有一个菜单,右键单击我的对话框。



在其中一个菜单中,我做了一些处理并显示另一个对话框是没有模式的。在此处理过程中,用户应该能够:

1.单击主对话框的任何其他菜单。

2.如果在主对话框上点击关闭,它应该等待此处理完成并在完成处理完成后全部关闭。

3.应该能够重复相同的过程n次(例如,第二个无模式对话框可以在1个以上打开根据处理和选项选择不同结果的实例)。



为此,我尝试使用Multithread,我的第二个无模式对话框中的每一个都可以连接到一个不同的线程和主对话也可以保持活动状态,在此处理期间可以访问其所有菜单。



问题:我无法确定线程是否正确退出,析构函数我的第二个无模式对话框没有得到断点。应用程序以exitcode关闭,因为2是我的观察结果..



我想了解有关MultiThreading的更多信息,这是最佳解决方案还是其他任何参考建议?



提前谢谢..



紧急删除 - OriginalGriff [/ edit]

Hi All,

I need some help on my below scenario:

I have created a dialog based application in Visual Studio 2010 in MFC C++. My Main Dialog is Modal and I have a Menu that displays on Right Click on my Dialog.

In one of the Menu, I do some processing and display another Dialog which is modeless. During this processing, User should be able to:
1. Click on any other menu of Main Dialog.
2. If Close is hit on the Main Dialog, it should wait until this processing is completed and Close All once processing is completed.
3. Should be able to repeat same process n number of times (for eg. The 2nd Modeless dialog can be opened in more than 1 instance with different result as per processing and option chosen).

For this, I have tried to use Multithread where each of my 2nd Modeless dialog can be hooked up in a different thread & Main Dialog can also be kept alive with all its Menu accessible during this processing.

Problem: I am not able to determine if the thread exited correctly, destructor of my 2nd modeless dialog is not getting a breakpoint hit. The application closes with exitcode as 2 are my observations..

I want to learn more about MultiThreading and will this be the best solution or any other references are suggested?

Thank you in advance..

[edit]Urgency deleted - OriginalGriff[/edit]

推荐答案

没有意义。您不需要多线程来启用具有多个窗口的UI,无论是否为模态。但是,您可以而且应该使用单独的线程进行任何长时间运行的处理。不幸的是,快速问题&答案格式不是为了教授线程的整个主题;您可以使用适当的文档自己完成。



-SA
It makes no sense. You don't need multithreading to enable the UI with more than one window, modal or not. However, you can and should use a separate thread for any long-running processing. Unfortunately, the Quick Questions & Answers format is not designed to teach the whole topic of threading; you can do it yourself using appropriate documentation.

—SA


这篇关于MFC Parent&儿童对话 - 像多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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