views:

69

answers:

2

I am looking for a means to kill a Windows exe program that, when being tested from a python script, crashes and presents a dialog to the user; as this program is invoked many times, and may crash repeatedly, this is not suitable.

The problem dialog is the standard reporting of a Windows error:

"Foo.exe has encountered a problem and needs to close. We are sorry for the inconvenience"

and offers a Debug, Send Error Report, and Don't Send buttons.

I am able to kill other forms of dialog resulting from crashes (e.g. a Debug build's assert failure dialog is OK.)

I have tried taskkill.exe, pskill, and the terminate() function on the Popen object from the subprocess module that was used to invoke the .exe

Has anyone encountered this specific issue, and found a resolution?

I expect automating user input to select the window, and press the "Don't Send" button is one possible solution, but I would like something far simpler if possible

A: 

If you were to use CreateProcessEx or a WinAPI specific function, you might be able to call TerminateProcess or TerminateThread to forcibly end the process.

DeadMG
+2  A: 

Wouldn't it be easier to disable the error reporting feature?

Luke
So, how can I do that? ;-)
grrussel
http://www.windowsnetworking.com/articles_tutorials/Disable-Error-Reporting-Windows-XP-Server-2003.html
grrussel
Sadly, that disables (removes) the report button on the dialog, which thereafter merely has two buttons (Debug, and Close) but still blocks the process from being killed.
grrussel
OK, finally both disabling error reporting (for ALL programs, not just that one) and auto-enabling a debugger to use drwtsn32.exe as in http://support.microsoft.com/kb/188296 made it stop blocking on test crashes.
grrussel