Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32 进程崩溃时禁止弹出错误对话框 #20

Open
AlexiaChen opened this issue Oct 16, 2019 · 0 comments
Open

win32 进程崩溃时禁止弹出错误对话框 #20

AlexiaChen opened this issue Oct 16, 2019 · 0 comments
Labels
c/cpp C and CPP programming language windows windows平台相关的一系列东西 软件调试 调试技巧,思考

Comments

@AlexiaChen
Copy link
Owner


title: win32 进程崩溃时禁止弹出错误对话框
date: 2018-06-15 18:58:23
tags:
- 调试
- Win32

在main函数程序初始化的时候加入以下代码即可:

SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); _set_abort_behavior(0,_WRITE_ABORT_MSG);

这样程序就悄无声息的崩溃了,不然守护进程都不起作用。如果不这样做,弹出错误对话框程序如果不点击关闭或发送错误报告就僵死在那里了,守护进程一直发现进程没挂,就不重启。

参考:

[1] https://stackoverflow.com/questions/9718695/how-can-i-supress-all-error-dialogs-when-a-process-crashes-i-only-want-it-to-cr

[2]
https://stackoverflow.com/questions/1861506/prevent-modal-dialog-on-win32-process-crash

@AlexiaChen AlexiaChen changed the title : win32 进程崩溃时禁止弹出错误对话框 win32 进程崩溃时禁止弹出错误对话框 Oct 16, 2019
@AlexiaChen AlexiaChen added c/cpp C and CPP programming language windows windows平台相关的一系列东西 软件调试 调试技巧,思考 labels Oct 16, 2019
@AlexiaChen AlexiaChen reopened this Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/cpp C and CPP programming language windows windows平台相关的一系列东西 软件调试 调试技巧,思考
Projects
None yet
Development

No branches or pull requests

1 participant