SvcSetAccept

Specifies the control codes that the service will accept.

 

Syntax:

SvcSetAccept(codes)

Parameters:

(i) codes can be 0 to specify no code to process, or it can be one or more of the following control codes, combined using the bitwise OR ('|') operator:

Value

Controls accepted

Meaning

1

SERVICE_ACCEPT_STOP

The service can be stopped

2

SERVICE_ACCEPT_PAUSE_CONTINUE

The service can be paused and continued

4

SERVICE_ACCEPT_SHUTDOWN

The service is notified when system shutdown occurs

32

SERVICE_ACCEPT_HARDWAREPROFILECHANGE

The computer's hardware profile has changed.

64

SERVICE_ACCEPT_POWEREVENT

The computer's power status has changed.

128

SERVICE_ACCEPT_SESSIONCHANGE

The computer's session status has changed (requires XP/2003 or newer.)

256

SERVICE_ACCEPT_PRESHUTDOWN

The computer is about to shutdown (requires Vista/2008 or newer.)

32768

SERVICE_ACCEPT_LOGOFF

Notify of logoffs.

Returns:

(i) previous value the previous value for "codes", or -1 if not running as a service.

 

By default, a WinBatch service will accept and automatically process SERVICE_CONTROL_STOP commands. If you use the SvcSetAccept function, you will be responsible for processing any of the control codes that are received, including SERVICE_CONTROL_STOP (i.e., it will no longer be processed automatically).

 

See also:

SvcSetState, SvcWaitForCmd, See Run as a Native Service