This function is called to load a service.

HANDLE ActivateService(
  LPCWSTR lpszDevKey,
  DWORD dwClientInfo


  • lpszDevKey
    [in] Pointer to the string that contains the name of the service to load. Information concerning the service's DLL name and other parameters is specified in the registry key HKEY_LOCAL_MACHINE\Services\lpszDevKey.
  • dwClientInfo
    [in] Reserved and should be set to zero.

Return Values

A handle to the service is returned on success. A NULL value is returned on failure. For extended error information, call GetLastError.


Once ActivateService has been called, Services.exe retrieves information about the service in HKEY_LOCAL_MACHINE\Services\lpszDevKey and loads the service as if it were being loaded upon system initialization.

For more information about setting up a service registry key for ActivateService or for use at system initialization, see Services.exe at System Startup.


OS Versions: Windows CE .NET 4.0 and later.
Header: Service.h.
Link Library: Coredll.lib.

See Also

Services.exe | Services.exe at System Startup

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.