"Lonewolf" <an*******@mozilla.orgwrote in message
news:ui**************@TK2MSFTNGP03.phx.gbl...
could someone please enlighten me on how I could turn on the above
mentioned two windows services programmatically? Reason is i am writing a
program which needs to turn on these two services in order to access the
UPnP router to turn on port forwarding programmatically, and turn it off
after that. Can someone please enlighten me on the functions or Win32 API
to call to achieve it ? thank you so much for enlightening me on this.
There are more than a few calls you need to use in a proper solution.
// Once
OpenSCManager();
// Repeat for each service
OpenService();
StartService();
CloseServiceHandle();
// Once
CloseServiceHandle();
Note that you will generally need to run in the context of an account with
administrative privileges.
Regards,
Will