前两天看了Delphi版面精华区中的“进程死亡的自动复活“一文,觉得作者的思路很不错,利用api来监视进程的活动,当被销毁时就自动再创建进程。仔细推敲之后,发觉其实用vb也是可以做到的。于是花了半天的时间写了以下的程序,实现了使用WaitForSingleObjectAPI来监视被创建的进程的活动,一旦返回除time out 之外的消息就自动创建新的进程。以下为其实现代码。在win2000 server + vb 6.0下通过。
SHOW FULL COLUMNS FROM `jrk_downrecords` [ RunTime:0.001139s ]
SELECT `a`.`aid`,`a`.`title`,`a`.`create_time`,`m`.`username` FROM `jrk_downrecords` `a` INNER JOIN `jrk_member` `m` ON `a`.`uid`=`m`.`id` WHERE `a`.`status` = 1 GROUP BY `a`.`aid` ORDER BY `a`.`create_time` DESC LIMIT 10 [ RunTime:0.110759s ]
SHOW FULL COLUMNS FROM `jrk_tagrecords` [ RunTime:0.000876s ]
SELECT * FROM `jrk_tagrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 20 [ RunTime:0.001491s ]
SHOW FULL COLUMNS FROM `jrk_member` [ RunTime:0.000958s ]
SELECT `id`,`username`,`userhead`,`usertime` FROM `jrk_member` WHERE `status` = 1 ORDER BY `usertime` DESC LIMIT 10 [ RunTime:0.003174s ]
SHOW FULL COLUMNS FROM `jrk_searchrecords` [ RunTime:0.000859s ]
SELECT * FROM `jrk_searchrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 5 [ RunTime:0.003793s ]
SELECT aid,title,count(aid) as c FROM `jrk_downrecords` GROUP BY `aid` ORDER BY `c` DESC LIMIT 10 [ RunTime:0.017437s ]
SHOW FULL COLUMNS FROM `jrk_articles` [ RunTime:0.001124s ]
UPDATE `jrk_articles` SET `hits` = 2 WHERE `id` = 278455 [ RunTime:0.020536s ]