如何禁用Windows Vista上的“debugging/closures应用程序”对话框?

当应用程序在Windows上崩溃并且安装了Visual Studio等debugging器时,将出现以下模式对话框:

[标题:Microsoft Windows]

X已经停止工作

一个问题导致程序停止正常工作。 Windows将closures该程序,并通知您是否有解决scheme。

[debugging] [closures应用程序]

有没有办法来禁用此对话框? 也就是说,程序刚刚崩溃,并默默燃烧?

我的情况是,我想运行几个自动化testing,其中一些会由于testing中的应用程序中的错误而崩溃。 我不想让这些对话框停止自动运行。

search周围我想我已经find了解决scheme禁用此Windows XP,这是nuking这个reg键:

HKLM \ Software \ Microsoft \ Windows NT \ CurrentVersion \ AeDebug \ Debugger

但是,这在Windows Vista上不起作用。

要强制Windows错误报告(WER)进行故障转储并closures应用程序,而不是提示您debugging程序,您可以设置这些registry项:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting] "ForceQueue"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent] "DefaultConsent"=dword:00000001 

设置完成后,当您的应用程序崩溃时,您应该看到* .hdmp和* .mdmp文件:

 %ALLUSERSPROFILE%\Microsoft\Windows\WER\ 

看这里:

http://msdn.microsoft.com/en-us/library/bb513638.aspx

registry编辑器

DWORD HKLM或HKCU \ Software \ Microsoft \ Windows \ Windows错误报告\ DontShowUI =“1”

会让WER悄然报告。 然后你可以设置

DWORD HKLM或HKCU \ Software \ Microsoft \ Windows \ Windows Error Reporting \ Disabled =“1”

阻止它与MS交谈。

我不确定这是否指的是完全相同的对话,但是这是来自Raymond Chen的替代方法:

 DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX); 

我必须禁用这个在Windows 64位的Firefox版本自动化工作,我做了以下事情:

  • inputgpedit.msc
  • 计算机configuration – >pipe理模板
  • Windows组件 – > Windows错误报告
  • 将“禁止显示关键错误的用户界面”设置为已启用

这与客户体验报告所完成的类似: http : //www.blogsdna.com/2137/fix-windows-installer-explorer-update-has-stopped-working-in-windows-7.htm

在我的情况下,我只想抑制我的unit testingpopup窗口,而不是整个系统。 我发现需要组合一些函数来抑制这些错误,例如捕获未处理的exception,抑制运行时检查(如堆栈指针的有效性)和错误模式标志。 这是我用了一些成功的:

 #include <windows.h> #include <rtcapi.h> int exception_handler(LPEXCEPTION_POINTERS p) { printf("Exception detected during the unit tests!\n"); exit(1); } int runtime_check_handler(int errorType, const char *filename, int linenumber, const char *moduleName, const char *format, ...) { printf("Error type %d at %s line %d in %s", errorType, filename, linenumber, moduleName); exit(1); } int main() { DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX); SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)&exception_handler); _RTC_SetErrorFunc(&runtime_check_handler); // Run your tests here return 0; } 

在WPF应用程序中

 [DllImport("kernel32.dll", SetLastError = true)] static extern int SetErrorMode(int wMode); [DllImport("kernel32.dll")] static extern FilterDelegate SetUnhandledExceptionFilter(FilterDelegate lpTopLevelExceptionFilter); public delegate bool FilterDelegate(Exception ex); public static void DisableChashReport() { FilterDelegate fd = delegate(Exception ex) { return true; }; SetUnhandledExceptionFilter(fd); SetErrorMode(SetErrorMode(0) | 0x0002 ); } 

您必须实现一个未处理的exceptionfilter,它将简单地退出您的应用程序,然后使用SetUnhandledExceptionFilter()设置该filter函数。

如果您使用安全CRT,则还必须提供自己的无效参数处理程序,并使用_set_invalid_parameter_handler ()进行设置。

这个博客也有一些信息: http : //blog.kalmbachnet.de/?postid=75

在testing过程中,您可以使用ADPlus之类的“debugging器”运行,可以通过许多有用的方法来configurationADPlus ,以便收集错误数据(小型转储),同时避免上面所述的模态对话问题。

如果您希望在应用程序在生产中崩溃时获得一些有用的信息,则可以configurationMicrosoft错误报告以获取类似于ADPlus数据的内容。

这不是一个直接的答案,因为这是一个解决方法,问题是关于如何禁用该function,但在我的情况下,我是一个服务器上的用户权限有限,不能禁用该function之一其他答案。 所以,我需要一个解决方法。 这可能会为至less一些最终在这个问题上的其他人起作用。

我使用了autohotkey portable,并创build了一个macros,每分钟检查一次,看是否存在popup框,如果存在,点击buttonclosures程序。 在我的情况下,这就足够了,并将其他function留给其他用户使用。 它要求我在运行风险程序时启动脚本,但它适用于我的需要。

脚本如下:

 sleep_duration = 60000 ; how often to check, in milliseconds. ; 60000 is a full minute Loop { IfWinExist, ahk_class #32770 ; use autohotkey's window spy to confirm that ; ahk_class #32770 is it for you. This seemed to be consistent ; across all errors like this on Windows Server 2008 { ControlClick, Button2, ahk_class #32770 ; sends the click. ; Button2 is the control name and then the following ; is that window name again } Sleep, sleep_duration ; wait for the time set above } 

编辑:一个快速的标志。 当其他事情出现时,这似乎是试图在前台窗口中激活控制 – 它应该在后台发送给程序。 如果我find一个解决方法,我会编辑这个答案来反映它,但现在,谨慎使用它,并试图在一台机器上同时做其他工作。

在互联网上的其他一切尝试摆脱只是及时debugging,我发现一个简单的方法,实际上工作,我希望将帮助别人。

转到控制面板转到pipe理工具转到服务查看机器debuggingpipe理器的列表右键单击它,然后单击属性在常规选项卡下,查找启动types单击禁用。 点击应用并确定。

我没有看到debugging器的消息,因为我的电脑运行完美。

而不是在registry中更改值,您可以完全禁用Windows Server 2008 R2,Windows Server 2012和Windows 8上的错误报告: serverWerOptin /disable

https://technet.microsoft.com/en-us/library/hh875648(v=ws.11).aspx