MFC信号/异常处理 [英] MFC Signal / exception handling

查看:147
本文介绍了MFC信号/异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发MFC应用程序.每当我的应用程序崩溃(异常或任何其他信号)时,我都需要一种功能来将所有数据保存到文件中.

我尝试了以下方法:

1. http://msdn.microsoft.com/en-us/library/5z4bw5h5%28v = vs.80%29.aspx [ http://msdn.microsoft.com/en-us/library/xdkz3x12%28v = VS.100%29.aspx [

I am developing an MFC application. I need a feature to save all the data into a file whenever my application crashes (either exception or any any other signals).

I tried the following:

1. http://msdn.microsoft.com/en-us/library/5z4bw5h5%28v=vs.80%29.aspx[^]

2. http://msdn.microsoft.com/en-us/library/xdkz3x12%28v=VS.100%29.aspx[^]

Both didnt work. Can you guys guide me through.

NOTE: I dont have TRY/CATCH block in my application.

Thanks,

推荐答案

在所有线程堆栈的最顶部捕获所有异常,并尝试保存要在异常处理中保存的内容.请记住,尝试保存数据本身可能会遇到异常.在外部异常句柄中也捕获此异常,并以指示最后一次保存数据的机会失败,无法执行其他任何操作"的方式处理此内部异常.

—SA
Catch all exceptions on the very top of stack of every threads and try to save what you want to save in the exception handling. Remember that an attempt to save data can itself through exception. Catch this exception as well inside the outer exception handle and process this inner exception in the way indicating "last chance to save data failed, nothing else can be done".

—SA


这篇关于MFC信号/异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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