SetUnhandledExceptionFilter让程序优雅的崩溃(转)
来源:互联网 发布:打卡网络用语 编辑:程序博客网 时间:2024/05/18 21:41
虽然是大公司的产品,QQ它还是会在我们的折腾下崩溃的,但是它总是崩溃的很优雅,还要弹出自己的对话框来结束。并且发送报告,去掉了系统默认的发送报告的对话框。
所以一拍脑袋,想让自己的程序崩溃的体面一点。
自己想了大概的思路,觉得可以用一个进程来监控目标程序。的确也可以拿到了目标程序崩溃的信息,知道它什么时候崩溃的,也可以做额外的操作,但是这样是没办法把默认的发送错误的对话框去掉的。
然后又有人说是不是采用了类似钩子的方法把这个东西在哪里勾掉了。
最后网上查了一番,发现SetUnhandledExceptionFilter这个函数解决了一切。
总结了下搜到的资料,这个函数的返回值有三种情况:
EXCEPTION_EXECUTE_HANDLER equ 1 表示我已经处理了异常,可以优雅地结束了
EXCEPTION_CONTINUE_SEARCH equ 0 表示我不处理,其他人来吧,于是windows调用默认的处理程序显示一个错误框,并结束
EXCEPTION_CONTINUE_EXECUTION equ -1 表示错误已经被修复,请从异常发生处继续执行
具体使用方法如下:
#include
0 0
- SetUnhandledExceptionFilter让程序优雅的崩溃(转)
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- 使用SetUnhandledExceptionFilter让程序优雅的崩溃
- window下使用SetUnhandledExceptionFilter捕获让程序的崩溃
- 让c++程序优雅的崩溃
- 如何让程序优雅的崩溃
- SetUnhandledExceptionFilter拦不住的崩溃
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP注意事项
- 被释放遇到的Crash message sent to deallocated instance
- awk入门
- Intersection of Two Linked Lists
- java输出对象类总是为内存地址
- Uncaught SyntaxError: Unexpected end of input
- SetUnhandledExceptionFilter让程序优雅的崩溃(转)
- 一位自学Android的经验总结
- Mysql 开启远程访问
- iOS学习之—— dequeueReusableCellWithIdentifier
- poj-3071 Football 【概率dp,位运算】
- swift基础笔记3-枚举
- android开发之使edittext输入弹出数字软键盘。亲测可用。手机号登陆注册常用。
- Python.Paste指南之Deploy(1)-概念
- JavaScript 基础