I would like to disable (in a VS2010 C program) the crash dialog window which pops up on screen when a GPF occurred (You know the xxx.exe as stopped working)
I tried on win2008 and win7:
- SetErrorMode(SetErrorMode(SEM_NOGPFAULTERRORBOX)|SEM_FAILCRITICALERRORS);
- try/catch (with SEH, but some parts of the code aren't wrapped in)
- SetUnhandledExceptionFilter()
Nothing works… still with this damned window
Do I forget something ?
The only thing which is working is to modify the “DontShowUI” key in register base
(HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting)
but it’s just not clean, and I would prefer a “coding” solution (and I cannot change the register into my code !)
Do you have an idea ? (except fixing the program itself to avoid the GPF of course 🙂
Thanks…
note : Interesting, under Cygwin the crash dialog doesn’t appear !
The best way to disable the crash box is to remove whatever code is causing your program to crash. This box will never appear for a correct program.
Edit: As for what’s actually wrong with your call to
SetErrorMode, it should be:or similar. I think you misread the blog article you cited in the comments.