Share via

ActivateService (Windows CE 5.0)

Send Feedback

This function is called to load a service.

HANDLE ActivateService(LPCWSTRlpszDevKey,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 Registry Settings.

Security Note   ActivateService can be called from either trusted or untrusted applications, regardless of the setting of the DEVFLAGS_TRUSTEDCALLERONLY registry flag for the service. If a trusted application activates a service, an untrusted application cannot unload the service. However, if an untrusted application activates the service, then either a trusted application or an untrusted application can unload the service.


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

See Also

Services.exe | Services.exe Registry Settings

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.