防止应用程序被终止 [英] Prevent application from getting terminated

查看:58
本文介绍了防止应用程序被终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在mfc中开发一个测试应用程序,点击Enter键,应用程序就消失了。

有没有办法阻止应用程序被终止?



谢谢。

I am developing a test application in mfc, On clicking on the "Enter key", the application gets disappeared.
Is there any way to prevent application from getting terminated?

Thank you.

推荐答案

最可能的解释是表格上有一个OK键或类似的键采用ENter键 - 它充当接受按钮 - 并关闭表单,关闭应用程序。在每个按钮处理程序代码函数中放置一个断点,你应该很容易找到哪一个。
The most likely explanation is that there is an "OK" key or similar on the form which takes the ENter key - it's acting as an "Accept" button - and that closes the form, which closes the application. Put a breakpoint in each of your button handler code functions and you should find which one pretty easily.


覆盖你的 OnOK 方法对话框类。

同样,为了防止在按下转义键时关闭对话框,请覆盖对话框类中的 OnCancel 方法。
Override the OnOK method in your dialog class.
Similarly, to prevent the dialog closing on pressing the escape key, override the OnCancel method in your dialog class.


这篇关于防止应用程序被终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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