How can I supress all error dialogs when a process crashes (I only want it to crash silently)

前端 未结 2 1287
长情又很酷
长情又很酷 2021-01-05 02:13

I have a process which I start with CreateProcess, then I wait for it to finish and check its exit code. I do this in batch mode and I don\'t want any message boxes to show

2条回答
  •  粉色の甜心
    2021-01-05 02:53

    You're dealing with three kinds of abnormal termination:

    1. Uncaught C++ exception
    2. C++ library exiting
    3. Win32 uncaught excecption.

    On Windows, C++ exceptions typically reuse parts of Win32 exception handling. Therefore your method addresses 1 and 3, but misses 2. That's why the message is coming from "Microsoft Visual C++ Runtime Library". You'll need _set_abort_behavior(0, _WRITE_ABORT_MSG) to suppress that.

提交回复
热议问题