Click here to Skip to main content
15,920,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I pass parameter to a running windows service control method

eg.

sc control Myservice 23 arg1 arg2

What I have tried:

i have create the service and the control function id 23, and it work fine
Posted
Updated 8-Dec-16 3:54am
v2
Comments
[no name] 5-Aug-16 12:15pm    
As far as I know you can send only a ControlCode. And btw. user defined ControlCodes should start at 128.

1 solution

Normally a service reads values at the startup like from the registry. In a running service you can allocate some global shared memory but you must grant the access rights.

Everything else you must handle in the worker function like in this Simple Windows Service in C++ which you can access via the control codes in the range of 128 to 255.

Pay attention that services are running in administrator mode.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900