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:

Open regedit.exe (you can type it in the Start Menu or run it through Task Manager)

Right-click on Windows Error Reporting, go to New and select DWORD (32-bit) Value

Give it the name DontShowUI (exactly as written here)

Open it (double-click) and in the field “Value data” type in the number 1

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”

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!

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…”