Computing.Net > Forums > Programming > monitoring programs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

monitoring programs

Reply to Message Icon

Name: wolven_king
Date: May 12, 2003 at 18:14:12 Pacific
OS: Windows ME
CPU/Ram: 900/128
Comment:

Is there anyway to have a computer check on programs running and restart a program that shuts itself down?
I have 2 computers on a network.One is running proxy.The proxy shuts down sometimes and other computer cannot access internet.
I think I may end up creating a program to do this.



Sponsored Link
Ads by Google

Response Number 1
Name: Chad
Date: May 16, 2003 at 08:43:48 Pacific
Reply:

I'm not sure what languages you are familiar with in programming, but VB has a easy way to do this. Write a simple program that launches your application itself using the SHELL command. Then a routine to periodically, say every second or so, attempt to "activated" that running application. If successul, the loop continues. Otherwise an error occurs and you trigger a re-launch of the program.

I tried doing this for a program once, attempting to tell when it exited so I could do something that need to be done after it exited but NOT while it was running. For some reason I could not get the Application ID/activation method to work consistently so I went about it a different way. IN WINDOWS 95 AND ABOVE OPERATING SYSTEMS YOU CANNOT DELETE A PROGRAM FILE THAT IS CURRENTLY RUNNING. Making use of this basic fact I wrote a loop that tried to delete the file every second. The loop continued so long as their was a error, indicating the application was still running. Now at the beginning of the code the program makes a copy of the .exe file that it is trying to delete for backup, then launches the original, then the deletion attempt loop begins. Once this loop is finally successful and the file is deleted, indicating the program is no longer running, it jumps to code that restores the file file from the backup to put things back the way they should be. This method has worked flawless and effectively for me. It is also very quick..the deletition routine, set on a 1 second interval loop, deletes the file the very second the program ends and unloads, and rest of the code runs immediately.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: monitoring programs

8085 program www.computing.net/answers/programming/8085-program/6902.html

Need programmers help!! www.computing.net/answers/programming/need-programmers-help/2136.html

Batch file name save www.computing.net/answers/programming/batch-file-name-save/16553.html