Question

I need to develop a "Watchdog" program to detect when a program has crashed, kill the process and then restart it. Unfortunately, the original developer of this program is no longer here, and his computer is no longer able to compile it without buying another expensive license. The program in question crashes with a VB error code ("Runtime error 5 ... etc). I need to detect when the program enters this state. Alternatively, I need to be able to see the first program's error handler if possible, so I can check if it is in a "trappable" error, or at the very least, be able to check the current status of the program in question.

Was it helpful?

Solution

Programs are isolated from each other. The CPU makes it so every program thinks it's the only program running and, in 32 bit, has 4 GB of memory all to it's self. So a program cannot affect or monitor another.

So debugging is an exception to the above because computers wouldn't be usable without it and that is built into the CPU/OS.

So run the VB6 program under a debugger, most biz computers have NTSD installed. Note this is not a basic debugger but a machine code debugger.

If it's a window then just wait for the window title. You can use API calls like FindWindow to monitor window titles.

HWND FindWindow(          LPCTSTR lpClassName,
    LPCTSTR lpWindowName
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top