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.

Roei BarRank #1,271 · 1.4K reputationPosted Aug 23, 2009, 12:28 AM EDT
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 :
using System; using System.Collections.Generic; using System.Text; using System.Web.Caching; namespace WinCaching { public class Caching { public static Cache Cache { get { return (System.Web.HttpContext.Current == null) ? System.Web.HttpRuntime.Cache :Add new DataWinCaching.Caching.Cache.Insert("TestKey", txtName.Text, null, DateTime.Now.AddMinutes(60), TimeSpan.Zero); Similarly, to retrieve the same data, you can access the property as string s = WinCaching.Caching.Cache["TestKey"].ToString();dont forget to mark this as "Accepted Answer"
Danatas GerviRank #4,152 · 361 reputationPosted Aug 23, 2009, 3:36 AM EDT
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.