Passing parameters to a running winxp service using command line
I wrote a little service that blocks programs from running at a certain time of the day.
For example, if I wouldn't want my brother from opening some games from 13:00 to 16:00.
Everything works fine, but now, i would like to be able to set/change the time limits by writing commands from the command line while the service is running.
If any of you can help me please or direct me to any sources that might help, please do.
Daniel.
BTW. The service is for purely educational reasons.
Danatas GerviPosted Aug 23, 2009, 7:36 AM
In such case i would write a little app (console)
that gets from user input new values(command line args or so)
and creates a file in shared with service folder. Service every interval of time (1 min for example) will cheek that this file presence, read from it new data and delete the file.
Roei BarPosted Aug 23, 2009, 4:28 AM
what you are looking for is a lot of work while you will need to connect to the ServiceCollectionController and get the Service
then you will need to create in the service a delegate event on a property and onchange reset the properties.
i have a better idea for you ....
use .net Caching using system.web.cache
create a cache file dependency then on every change it will be updated.
set the properties to read the xml directly
and thats it :-)
here is a sample Cache class and usage :
dont forget to mark this as "Accepted Answer"