Oncustomcommand executes when the service Control Manager (SCM) passes a custom command to the service. Specifies actions to take when a command with the specified parameter value occurs.
The only values for a custom command so can define in your application or use in Oncustomcommand is those between 1 256.
integers below correspond to system-reserved values.
Create one Windows Service & Implement Below Code in Service:
namespaceMywindowsservice
{
PublicPartialclassService1:ServiceBase
{
PublicenumSimpleservicecustomcommands{Command1 = Command2, =129, Command3 = 130};
PublicService1 ()
{
InitializeComponent ();
}
protected void onstart (string [] args)
{
}
protected void onstop ()
{
}
protected void oncustomcommand (int command)
{
base . Oncustomcommand (command);
switch (command)
case (int ) simpleservicecustomcommands . COMMAND1:
//command1 implementation
break ;
case (int ) simpleservicecustomcommands . COMMAND2:
break ;
Case (int) simpleservicecustomcommands. Command3:
//COMMAND3 Implementation
;
default :
break ;
 }       
}
}}
Call Windows Service customcommands from User application:
Windows Service Command Reprint