3

I'm working on a program ("A") which uses ShellExecuteEx to call another program ("B") that occasionally crashes. Program A can detect crash of B, and can kill B using TerminateProcess.

However, when B crashes (and before A has terminated it), up pops Windows' "Program B has stopped working" dialog (WerFault.exe). So although A can kill B, that leaves behind an instance of WerFault.exe each time B fails.

I thought I might have some joy by using the WER api to invoke WerAddExcludedApplication and put B on the excluded list. However, all that seems to do is to change the "has stopped working" dialog so that it offers only "Close" and "Debug", and omits "Check online for a solution".

Any idea how I can get B to just crash without invoking WerFault.exe? (Windows 7).

I did see this thread: How to crash a process on Windows-7 without getting the WER dialog? . However there the intent was to ensure that WER was always invoked, not how to disable or dismiss it.

Suggestions?

Community
  • 1
  • 1
gwideman
  • 2,705
  • 1
  • 24
  • 43
  • Interim solution, maybe useful for others: In program A the "kill crashed app" routine, after calling TerminateProcess on progam B, uses Windows API FindWindow to find the WER window. (WER seems to adopt as a title the title of the crashed program. Don't know how much this varies). Next, A calls SendMessage(HWnd for WER, WM_Close), which closes WER. I put a few seconds delay between terminating B and FindWindow, on the theory that prior to killing B there would be two windows with the same title. Not sure if that's essential. – gwideman Sep 17 '13 at 01:35

0 Answers0