Ok. I have a program (not mine) that needs to run. It needs to run all the
time.

Sometimes it crashes. Fine. I wrote a program that will call the second
program with CreateProcess, monitor it's existance with OpenProcess, and
restart it when necessary. Works great.

However, the second program will occasionally GPF with an access violation.
When this happens, OpenProcess still works fine, inducing my monitor program
to assume that everything is well, while the access violation dialog box
sits on the screen until someone hits the 'OK' button.

What I need to do is to detect when such a GPF happens in the second
application. So far, the only idea I have is to enumerate all of the
windows in the process, looking for one whose caption ends with 'Application
Error', and then enumerating for the 'OK' button and sending a WM_CLICK
message to it. Since this seems horribly kludgy, I'm wondering if there's a
better way that I'm missing.

--
Colin McGuigan