I am using CreateService
to installs a Windows Service executable however I can\'t seem to find out how to set the description for the service.
Does any
Have a look at this MSDN page for an example. You use the ChangeServiceConfig2
method.
SERVICE_DESCRIPTION sd;
SC_HANDLE schService;
SC_HANDLE schSCManager;
// Not shown: Get a handle to the SCM database.
// Not shown: Get a handle to the service.
sd.lpDescription = TEXT("Description");
ChangeServiceConfig2( schService, // handle to service
SERVICE_CONFIG_DESCRIPTION, // change: description
&sd) ) // new description
Call ChangeServiceConfig2 passing SERVICE_CONFIG_DESCRIPTION
as the dwInfoLevel
parameter. You will also need a handle to the service, but CreateService
gives you one of those.
SERVICE_DESCRIPTION description = { L"The service description" };
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &description);