In Visual C++ when terminate()
is called the default behavior is to call abort()
which by default shows a message box and then - after OK button on the message box is pressed - terminates the application. The "shows message box" part is not very good for programs that must work without human interaction since the program just hangs until the button is pressed.
In VC++8 Microsoft introduced _set_abort_behavior()
function that can be called at application startup and prohibit showing the message box in abort()
.
How do I achieve the same in VC++7 and ea开发者_StackOverflowrlier? I could write my custom terminate()
handler, but what is the best action to invoke inside it so that the program terminates the same way as with abort()
but without the message box?
Call the operating system's process terminate function. TerminateProcess() on Windows.
精彩评论