views:

1198

answers:

3

On Vista, I got a problem with the application crash handler. Basically, if something unexpected occurs which cannot be captured by SEH, I get this pop-up window with "The application stopped working", blablabla, "Close program/Debug program" -- that is, after I disable the error reporting using the system control panel. With error reporting enabled, you would get a task dialog with search for solution online, close, debug.

This is not so funny if it happens in automated tools, and I wonder whether there is a way to get rid of it totally, read, if my app crashes, it just crashes to the command line or disappears but does not bring up a dialog.

+5  A: 

Use

SetErrorMode(SetErrorMode(0)|SEM_NOGPFAULTERRORBOX);

But I would suggest to install an exceptions handler which creates a dump so you can verify what happened. For example crashrpt (or here).

See also

Wimmel
A: 

http://www.vistaheads.com/forums/microsoft-public-windows-vista-general/172747-re-help-how-do-i-turn-off-kernel-debugging.html

HTH

plan9assembler
That's for kernel debugging, and requires a change that isn't suitable for widly distributed applications. Also, I have doubts that this is the correct method used to prevent the dialog box.
Raymond Martineau
A: 

Function signal works on all POSIX platforms:

signal(SIGSEGV, &signal_handler);

If you need to trap an exception that isn't supported by signal, you can also take a look at AddVectoredExceptionHandler, a function specific to W32.

Raymond Martineau