Export (0) Print
Expand All

Activating a Service Programmatically

Windows CE .NET

Services.exe can load a service based on the value located in the built-in registry key located under the HKEY_LOCAL_MACHINE\Services\<Service Name> registry key. This will allow the service to be restarted if it has been completely unloaded.

To load a service programmatically, you must call the ActivateService function. The following code example shows how to load the Telnet server using ActivateService.

ActivateService(L"TELNETD", 0);

A call to ActivateService will cause Services.exe to load the Telnet server based on the settings located under the HKEY_LOCAL_MACHINE\Services\TELNETD registry key. Upon completion of loading the service, ActivateService will load any super service sockets that are appropriate.

To load a service that is running multiple instances from the same DLL, call the RegisterService function instead of ActivateService.

See Also

Services.exe | Registering a Service Programmatically | RegisterService | ActivateService


 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.

Show:
© 2014 Microsoft