Prev: Former Professors Explains Educational Value of Free Software in Programming; Mercurial Interview
Next: shut down 64bit windows 7
From: Tony Johansson on 4 May 2010 12:26 Hi! In this example this OnCustomCommand listen to 5 different command that are integer. How can I send any of these integer to a service so it can rect and change it's behaviour ? I know only how I can start, stop,pause and such things protected override void OnCustomCommand(int command) { switch ( command) { case (int)FreeSpaceCommands.MonitorDDrive: _driveLetter = "D"; break; case (int)FreeSpaceCommands.MonitorEDrive: _driveLetter = "D"; break; case (int)FreeSpaceCommands.IncreaseFreeSpaceMinimumBy10: _minAcceptableFreespace += 10; break; case (int)FreeSpaceCommands.DecreaseFreeSpaceMinimumBy10: _minAcceptableFreespace -= 10; break; case (int)FreeSpaceCommands.MonitorHourly: _monitoringInterval = 3600000; break; } } enum FreeSpaceCommands { MonitorDDrive = 128, MonitorEDrive = 129, IncreaseFreeSpaceMinimumBy10 = 130, DecreaseFreeSpaceMinimumBy10 = 131, MonitorHourly = 132, } //Tony
From: Jeff Johnson on 4 May 2010 14:32 "Tony Johansson" <johansson.andersson(a)telia.com> wrote in message news:OTmOIa66KHA.5848(a)TK2MSFTNGP06.phx.gbl... > In this example this OnCustomCommand listen to 5 different command that > are integer. > How can I send any of these integer to a service so it can rect and change > it's behaviour ? Using the ServiceController.ExecuteCommand() method.
From: Tony Johansson on 4 May 2010 15:48 "Jeff Johnson" <i.get(a)enough.spam> skrev i meddelandet news:%23aCNvg76KHA.356(a)TK2MSFTNGP05.phx.gbl... > "Tony Johansson" <johansson.andersson(a)telia.com> wrote in message > news:OTmOIa66KHA.5848(a)TK2MSFTNGP06.phx.gbl... > >> In this example this OnCustomCommand listen to 5 different command that >> are integer. >> How can I send any of these integer to a service so it can rect and >> change it's behaviour ? > > Using the ServiceController.ExecuteCommand() method. So Calling this ServiceController.ExecuteCommand() method can as I believe only be done by using a program you can't for example not use any existing tool or program in .NET. It's easy to create such a program but the reason I ask is becuase it no reason to reinvent the wheel if such a tool already exist. //Tony
From: Jeff Johnson on 4 May 2010 17:30
"Tony Johansson" <johansson.andersson(a)telia.com> wrote in message news:%23QRH$K86KHA.5808(a)TK2MSFTNGP02.phx.gbl... >>> In this example this OnCustomCommand listen to 5 different command that >>> are integer. >>> How can I send any of these integer to a service so it can rect and >>> change it's behaviour ? >> >> Using the ServiceController.ExecuteCommand() method. > > > So Calling this ServiceController.ExecuteCommand() method can as I believe > only be done by using a program you can't for example not use any existing > tool or program in .NET. > > It's easy to create such a program but the reason I ask is becuase it no > reason to reinvent the wheel if such a tool already > exist. I didn't realize that's what you were asking for. The sc.exe command-line tool should be able to do this. I believe the "command" you want to use is "control". I guess it would look like this: sc control YourServiceName 12 |