C++项目,windows怎么样让程序爆掉的时候不弹出任何提示,直接退出

xiaoguailong3 2012-08-29 10:36:04
C++项目,windows怎么样让程序爆掉的时候不弹出任何提示,直接退出。release下?debug肯定是提示的,但是我看很多软件爆了还是会提示的,怎么让他不提示,跟linux里爆掉一样,直接退出
...全文
308 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
gfm688 2012-08-29
  • 打赏
  • 举报
回复
try
{
}
catch
{
}

不行么?
Eleven 2012-08-29
  • 打赏
  • 举报
回复
试下SetErrorMode();

0
Use the system default, which is to display all error dialog boxes.

SEM_FAILCRITICALERRORS
0x0001
The system does not display the critical-error-handler message box. Instead, the system sends the error to the calling process.

SEM_NOALIGNMENTFAULTEXCEPT
0x0004
The system automatically fixes memory alignment faults and makes them invisible to the application. It does this for the calling process and any descendant processes. This feature is only supported by certain processor architectures. For more information, see the Remarks section.

After this value is set for a process, subsequent attempts to clear the value are ignored.

SEM_NOGPFAULTERRORBOX
0x0002
The system does not display the general-protection-fault message box. This flag should only be set by debugging applications that handle general protection (GP) faults themselves with an exception handler.

SEM_NOOPENFILEERRORBOX
0x8000
The system does not display a message box when it fails to find a file. Instead, the error is returned to the calling process.

iswjh 2012-08-29
  • 打赏
  • 举报
回复
发送WM_CLOSE不就行了
xiaoguailong3 2012-08-29
  • 打赏
  • 举报
回复
这个是异常的日志吧?能控制让程序不弹出错误框直接退出?
[Quote=引用 3 楼 的回复:]
MiniDump
[/Quote]
xiaoguailong3 2012-08-29
  • 打赏
  • 举报
回复
SetUnhandledExceptionFilter()大部分异常通过此种方法都能捕获,不过栈溢出、覆盖的有可能捕获不到。 这个会不会弹出来呢,我想写个守护程序管理一个服务,要是出错了弹出来,守护程序还是认为服务在运行,没有退出

[Quote=引用 2 楼 的回复:]
SetUnhandledExceptionFilter()试试~
[/Quote]
xiaoguailong3 2012-08-29
  • 打赏
  • 举报
回复
SetUnhandledExceptionFilter()大部分异常通过此种方法都能捕获,不过栈溢出、覆盖的有可能捕获不到。 这个会不会弹出来呢,我想写个守护程序管理一个服务,要是出错了弹出来,守护程序还是认为服务在运行,没有退出
[Quote=引用 1 楼 的回复:]
这个有很多办法的。

可以通过函数SetUnhandledExceptionFilter()设置回调函数,用来处理程序未处理异常。可以参考
http://blog.csdn.net/alicehyxx/article/details/4355802。
[/Quote]
hurryboylqs 2012-08-29
  • 打赏
  • 举报
回复
MiniDump
Eleven 2012-08-29
  • 打赏
  • 举报
回复
SetUnhandledExceptionFilter()试试~
运算符科技 2012-08-29
  • 打赏
  • 举报
回复
这个有很多办法的。

可以通过函数SetUnhandledExceptionFilter()设置回调函数,用来处理程序未处理异常。可以参考
http://blog.csdn.net/alicehyxx/article/details/4355802。
--茶-- 2012-08-29
  • 打赏
  • 举报
回复
适当的组织try catch,一定可以到达你期望的效果
xiaoguailong3 2012-08-29
  • 打赏
  • 举报
回复
上10W行代码。你每个地方都来下么。。。不是一个函数

[Quote=引用 9 楼 的回复:]
try
{
}
catch
{
}

不行么?
[/Quote]
许文君 2012-08-29
  • 打赏
  • 举报
回复
搜SEH

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧