From my application, I use a COM API to make calls to another application. This results in the other application starting up in its own process and doing some things. Sometimes, these t开发者_如何学Gohings go badly and the application explodes. I handle the error coming back from COM just fine; but, the other application process crash causes a dialog to popup on the machine, asking if the process should be killed, or help sent to Microsoft, or something. This server is not monitored; there's nobody there. How do I suppress this dialog when it occurs on someone else's app?
Take a look at Debugging Functions on MSDN. I haven't tested the approach, but I think you should be able to achieve what you want by using DebugActiveProcess
, WaitForDebugEvent
, ContinueDebugEvent
and FatalExit
. The idea would be to wait for a debug event and if it's the one you want -- in this case, an unhandled exception (dwFirstChance
in EXCEPTION_DEBUG_INFO
is zero) -- terminate the process with FatalExit
, otherwise continue execution with ContinueDebugEvent
.
Like I said, it's just an idea, I haven't tested it. Also, Oleg's advice is much simpler if you don't mind disabling the Windows Error Reporting dialog box for the whole machine.
精彩评论