ServiceStartService

InstallShield 2015 » InstallScript Language Reference

The ServiceStartService function starts the service that is specified by szServiceName. If the service is running when the function is called, the installation stops it and then restarts it.

This function waits for the service to reach its running state before returning; it waits indefinitely as long as the service is updating the dwCheckPoint member of the SERVICE_IS_STATUS structure at least every dwWaitHint milliseconds. To force the function to return after a specific time interval, regardless of whether the service has started, you can change the nStartServiceWaitCount member of the structured variable SERVICE_IS_PARAMS to the appropriate time in seconds.

Syntax

ServiceStartService ( szServiceName, szStartServiceArgs );

Parameters

ServiceStartService Parameters

Parameter

Description

szServiceName

Specifies the name of the service.

szStartServiceArgs

Specifies a comma-delimited string of arguments to the service.

Return Values

ServiceStartService Return Values

Return Value

Description

>= ISERR_SUCCESS

Indicates that the function started the service.

< ISERR_SUCCESS

Indicates that the function was unable to start the service.

If this function fails, additional error information may be available by calling GetExtendedErrInfo and checking the value of its third argument. (This value typically indicates the result of internally calling the Windows API function GetLastError after a call to a Windows API function failed.)

You can obtain the error message text associated with a large negative return value—for example, -2147024891 (0x80070005)—by calling FormatMessage.

See Also