I have a windows console app that hosts a WCF service and also transcodes video using DirectShow. I use a great little app called Restart on Crash which reliably detects when a process has exited and automatically restarts it. The trouble is that, many times, a dialog box of one sort or another pops up and prevents the program from closing after a crash until I manually click away the dialog box. Is there a way to prevent a windows console app from showing dialogs on crash?

  • Not crashing in the first place would be a good start. If that is no option, what dialog exactly is preventing your application from closing (screenshot)? – Der Hochstapler Mar 25 '12 at 15:53
  • The trouble is, that there have been several. Since the app uses WCF,Directshow and COM there is more than one way it can go down. I've not yet cataloged the error messages. For now, I grabbed a little app that closes dialogs automatically. Next time I see a crash, I'll add the dialog to its list of watched items. – PixelRouter Mar 25 '12 at 17:09
  • @OliverSalzburg: Exactly does not matter. Any standard system dialog for uncaught structural exception. – Jan Hudec Nov 26 '13 at 7:49

There is quite detailed answer to a same question on stackoverflow: https://stackoverflow.com/questions/3561545/how-to-terminate-a-program-when-it-crashes-which-should-just-fail-a-unit-test/3637710#3637710

Non code-modifying solution is to open Register Editor and set [HKLM|HKCU]\Software\Microsoft\Windows\Windows Error Reporting\DontShowUI to 1.

  • The link is to another SE site, but it's better for answers to be self-contained. That portion of the answer doesn't really contain a solution without what's at the other end of the link. Consider including the essential information here and keep the link for attribution. – fixer1234 Oct 3 '15 at 4:27

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.