Can I turn off the Application Error dialog box?

I use Hudson as a continuous integration server to test C / C ++ code. Unfortunately, I have an error somewhere that leads to memory corruption, so on some Windows machines I sometimes get the "Application Error" dialog box explaining that the instruction refers to memory that cannot be read. This dialog box appears and basically hangs in the test run, as it requires manual intervention.

Is there a way to prevent this dialog from appearing so that the test run just fails and is reported as such in Hudson?

Is it possible to automatically create minidump instead of displaying a dialog?

+13
c ++ debugging windows memory build-automation
Apr 09 '09 at 17:32
source share
6 answers
  • Use the "Disable Error Reporting" as suggested by Mr. Ganti. See Also in this PC World article .
  • If you have MS Visual Studio on your build machine, it will catch application errors and open a dialog box. To disable these dialogs (as well as the Just-In-Time Debugging debugging feature in Visual Studio), run the drwtsn32.exe -i command to install Dr. Watson as the default system debugger. Dr. Watson will generate a core dump and silently exit. (See This Microsoft Knowledge Base article: http://support.microsoft.com/kb/q121434/ .)
+11
Apr 09 '09 at 18:06
source share

You can also do something like this programmatically using SetErrorMode. See this article for more details.

A simple example of how to use it is the following:

 SetErrorMode(GetErrorMode () | SEM_NOGPFAULTERRORBOX); 

The above "ORs" is the current mode with our desired addition.

+7
Apr 14 '09 at 10:21
source share

In addition to what rkb said, if you are using Windows XP 64bit, there are two sets of values. Those that are in the usual registry location, and those that are under the Wow6432Node key in HKLM . To upgrade both, run drwtsn32.exe -i from both %SYSTEMROOT%\system32 and %SYSTEMROOT%\SysWOW64 .

+2
Feb 19 '10 at 20:37
source share

Disable error reporting via:

  • Registry Editing - Add your application to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ PCHealth \ ErrorReporting \ ExclusionList, OR
  • Right-click on "My Computer", go to the "Advanced" tab and select the "Disable Error Reporting" option, OR
  • You can go to the services console in the Administration section, find the error reporting service, go to properties and disable it.
+1
Apr 09 '09 at 17:40
source share

You can use various _CrtSetReport functions to control how the C / C ++ runtime responds to various errors (_CrtSetReportHook, _CrtSetReportMode, _CrtSetReportFile, _CrtSetReportHook2)

+1
Apr 09 '09 at 17:45
source share

Use the try / catch statement to catch the exception and handle it the way you want.

-2
Apr 09 '09 at 17:34
source share



All Articles