Monitor an application - kill and regenerate if hang
Do need a favour here. I would like to monitor an application and kill it if it is hang and regenerate it. However, not able to find relevant code.
I'm able to get the kernel and user time by "getprocesstime". But not able to monitor the CPU usage (not able to get idle time) to kill the hang program.Understand that some programmer use "GetSystemTimes" function. But it does not work in my PC.
Any suggestion or free code to share? Thanks a lot!

