Editare

Partajați prin


ServiceBase.OnPowerEvent(PowerBroadcastStatus) Method

Definition

When implemented in a derived class, executes when the computer's power status has changed. This applies to laptop computers when they go into suspended mode, which is not the same as a system shutdown.

protected:
 virtual bool OnPowerEvent(System::ServiceProcess::PowerBroadcastStatus powerStatus);
protected virtual bool OnPowerEvent (System.ServiceProcess.PowerBroadcastStatus powerStatus);
abstract member OnPowerEvent : System.ServiceProcess.PowerBroadcastStatus -> bool
override this.OnPowerEvent : System.ServiceProcess.PowerBroadcastStatus -> bool
Protected Overridable Function OnPowerEvent (powerStatus As PowerBroadcastStatus) As Boolean

Parameters

powerStatus
PowerBroadcastStatus

A PowerBroadcastStatus that indicates a notification from the system about its power status.

Returns

When implemented in a derived class, the needs of your application determine what value to return. For example, if a QuerySuspend broadcast status is passed, you could cause your application to reject the query by returning false.

Remarks

Use OnPowerEvent to specify the processing that occurs when the system event indicated in the PowerBroadcastStatus enumeration occurs--for example, when the computer is placed in suspended mode or indicates low battery power.

OnPowerEvent is expected to be overridden when the CanHandlePowerEvent property is true.

Applies to

See also