开发者

Windows XP - monitor process & relaunch process if it crashes

开发者 https://www.devze.com 2023-01-24 18:12 出处:网络
This is my first windows question so apologies if this is obvious or badly worded. I have a touch screen station that runs Opera in Kisokmode (http://www.opera.com/support/mastering/kiosk/) which is

This is my first windows question so apologies if this is obvious or badly worded.

I have a touch screen station that runs Opera in Kisokmode (http://www.opera.com/support/mastering/kiosk/) which is great and works perfectly.

I want to be able to monitor the Opera process and relaunch it if it crashes or is closed.

Can anyone give me some d开发者_如何学运维irection on how this can be done, or is there any out-of-the-box software that can do this for me?


There are some software to monitor processes and restart them if they are killed:
http://www.knas.se/Applications/Restarter.aspx
http://drinkprog.com/kiwi/

Just one of the ways to implement such software would be:
1. Open a handle of the target process that needs to be monitored, using OpenProcess API with SYNCHRONIZE access right.
2. Wait infinitely on that handle using WaitForSingleObject or WaitForMultipleObjects APIs.
3. If the process exits or gets killed, then wait would be signaled (with return code WAIT_ABANDONED or WAIT_OBJECT_0).
4. Close the handle. Restart process and repeat the above steps.

0

精彩评论

暂无评论...
验证码 换一张
取 消