Register and unregister a Windows Service programmatically...
-
In VC++ when I used to write a Windows Service, I used to parse the command line arguments. If it is '-install' I used to call functions
OpenSCManager()
andCreateService()
to register the service ORDeleteService()
to remove it from the SC manager. (winsvc.h
) I am new to VC#... Please tell me the equivalent functions/code piece to do the above task. I am keen on doing this programmatically (if possible, off course) rather than using the installutil and stuff… -
In VC++ when I used to write a Windows Service, I used to parse the command line arguments. If it is '-install' I used to call functions
OpenSCManager()
andCreateService()
to register the service ORDeleteService()
to remove it from the SC manager. (winsvc.h
) I am new to VC#... Please tell me the equivalent functions/code piece to do the above task. I am keen on doing this programmatically (if possible, off course) rather than using the installutil and stuff…use ServiceInstaller Class Look into MSDN for help Sanjay Sansanwal www.sansanwal.com