Take what you can, spread more

Disabling “Has stopped working” dialogs

Pretty, right? I bet you’ve all seen this dialog in on one occasion or another. Truth is, they’re pretty much necessary to alert you something went wrong. But what if you really don’t want them to appear? Imagine you are using an application, and you know it crashes, but it’s still useful for some reason. One good example is if you’re a developer testing something, and you need to execute some program hundreds of times, regardless of whether it crashes or not. It isn’t a very good idea to have your desktop flooded with error messages.

Well, I have some good news for you – these messages/dialogs can be removed. Well, the application will still crash, but that’s life – at least you won’t be reminded of the obvious. Read on, I’ll offer you both a manual and automated solution for doing it.

Short background

If you’re a developer, you probably don’t need to read this part. Otherwise – “has stopped working messages” are triggered by what is called an “unhandled exception”. Exceptions are ways for programs (and parts of them) to report errors. For example “no more hard-disk space”, “no access rights”, “not enough RAM”, “no internet connection” are typical problems, reported through exceptions. When a part of a program encounters such a problem, it “throws” an exception. That exception travels through the program, in hope of being “handled”. Most well-written programs “handle” almost all of the “exceptions” they can encounter. “Handling” and exception means that the program deals with the problem and does not need help from the Operating System (OS). An example of handling the “no internet connection” problem is showing a message to the user “Internet connection needed, please connect to the Internet”. Sometimes the application can’t deal with the problem/exception and it is thrown up to the OS (in this case Windows), which terminates the program so that it does not damage itself or the system. Additionally, Windows shows you this dialog, so that you are informed.

So, turning off these messages can’t hurt your system – it’s just possible to not notice, that an application has crashed.

Manually disabling “Has stopped working” messages

Windows offers a “hidden” way to disable these dialogs. By “hidden” I mean there’s no user-friendly way to do it. Don’t worry though, it’s still pretty easy to do it, if someone shows you how. Here’s what you need to do:

  1. Open regedit.exe (you can type it in the Start Menu or run it through Task Manager)
  2. Expand HKEY_LOCAL_MACHINE
  3. In it, expand SOFTWARE
  4. In it, expand Microsoft
  5. In it, expand Windows
  6. In it, Click on Windows Error Reporting (you should have reached HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting)
  7. Right-click on Windows Error Reporting, go to New and select DWORD (32-bit) Value
  8. Give it the name DontShowUI (exactly as written here)
  9. Open it (double-click) and in the field “Value data” type in the number 1
  10. You’re done. No more “Has stopped working” dialogs will appear. And, if you decide to turn them back on, just change the value of DontShowUI to the number 0, or just delete DontShowUI

There you go, 10 (actually 9) really simple steps. Now, some advice – do this only if these messages really irritate you or you have some other good reason to hide them. Generally, it’s a good idea to stay informed if something crashes (that’s why people created error messages in the first place).

 Automatically disabling “Has stopped working” messages

As we discussed earlier, there’s no built-in Windows feature to turn of these annoying dialogs. What’s wrong with the “Manual” approach? Well, it’s too slow. Especially if you wan’t to quickly turn of the messages, start an application that causes a lot of them, stop it, and turn the messages back on. Sure, you can do it by hand, but it’ll be a big waste of time, for something so simple and linear that a short script could do it.

I had this situation, where I needed a fast, automatic way to toggle “Has stopped working” messages on and off. So I wrote one, and you can find it here – UnhandledExceptionsToggler (.NET 4.0) or here UnhandledExceptionsToggler(.NET 2.0). Both of these archives (.zip) contain an executable, which toggles “Has stopped working” messages on and off, its complete source code, and a sample test application, which causes a “Has stopped working” dialog (so you can check if the thing works).

   

The UnhandledExceptionsToggler works pretty simply – you start (Run As Administrator) it and if “Has stopped working” messages are enabled – it disables them, and if they are disabled – it enables them. Along with that it prints some text, the last part of which saying either “Result: unhandled exceptions window WILL be shown” or “Result: unhandled exceptions window WILL NOT be shown” – you can guess what they mean.

Disclaimer: You are free to use, modify and redistribute the application and its source code in any way you find fit, and I take no responsibility over any actions regarding the application and it’s source code.

 Last words

Thanks for reading, and I hope this was useful to you in some way. Just keep in mind – working with the registry can be dangerous. Disabling messages regarding exceptions, on the other hand, can leave you in the dark. As long as you have this in mind and you are careful, you can take full advantage of both manual and automatic disabling of “Has stopped working” messages and greatly improve your Windows experience!

, , , , , , , , , ,

14 Responses to “Disabling “Has stopped working” dialogs”

  • Steve says:

    Hey Georgi, seems this is the easiest way for me to contact you, my Bulgarian is a bit rusty 😉

    I’m interested in drive-free-z for some driving research here in Sydney Australia but having some trouble running the EXE and also downloading the .Net source. Are you still developing? Could you send me a copy of the source? Are you interested in development collaboration? The graphics sure look good, and it’s great that you can have city streets, not just Grand Prix!

    Looking forward to hearing from you
    Steve Rogers

    • admin says:

      Hey Steve, just sent you an e-mail (saw you contacted me there too) check it out 😉
      In short – I’ll give you anything you need + some short instructions later today (today in my time-zone at least)

  • Aram says:

    THANK YOU!!!VERY MUCH!!!

  • Shaun says:

    Is the exceptionthrower application available for download?

  • Victor says:

    Excellent work! Thanks for sharing!

  • Jon says:

    Thanks. Brings me back to the Unix way of doing things. Dr. Watson and Windows Error Reporting are useless for me since if I’m working on something I can always manually run it under a debugger.

    As a user, the dialog just wastes 5 seconds of my time and a click before I relaunch Joe Buggy Program (R).

  • Az says:

    Абе хубаво си го написал, но тези които не знаят много добре Английски как да се оправят?

  • Asif says:

    Thank you for this article…. I was tired of seeing this error reporting …. I am learning coding and every time when my code crushes it shows this report which is so disturbing ….

  • Eduardo says:

    Would it be possible to add command line parameters let’s say

    UnhandledExceptionsToggler.exe /disable
    UnhandledExceptionsToggler.exe /enable

    and get rid of the readline at the end?

    I would do it myself but I don’t have C# compiler on hand. :(

    • admin says:

      Good idea, I’ll get to it as soon as I find some spare time (probably not in the near future). Actually, come to think of it, this means you’ll need to run the command prompt elevated (i.e. “Run as Administrator”), which will take more time than dealing with “Press any key…” :)

  • daver says:

    Works perfectly. As my setup with Win7 embedded does not have regedit this .net 2 exe was the perfect solution.

    Thank you.

  • Ben says:

    Worked perfectly, thank you.

  • Asif says:

    Thanks a lot . It worked !

Leave a Reply to Az Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>