ServiceGetServiceState

InstallShield 2016 » InstallScript Language Reference

The ServiceGetServiceState function returns in nvServiceState the state of the service that is specified by szServiceName.

Syntax

ServiceGetServiceState ( szServiceName, nvServiceState );

Parameters

ServiceGetServiceState Parameters

Parameter

Description

szServiceName

Specifies the name of the service.

nvServiceState

Returns one of the following Windows-defined constants specifying the state of the service:

SERVICE_STOPPED
SERVICE_START_PENDING
SERVICE_STOP_PENDING
SERVICE_RUNNING
SERVICE_CONTINUE_PENDING
SERVICE_PAUSE_PENDING
SERVICE_PAUSED

Return Values

ServiceGetServiceState Return Values

Return Value

Description

>= ISERR_SUCCESS

Indicates that the function retrieved the state of the service. Additional status information is available in the SERVICE_IS_STATUS system variable.

< ISERR_SUCCESS

Indicates that the function was unable to retrieve the state of 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