Platforms to show: All Mac Windows Linux Cross-Platform

Back to WindowsPowerStateMBS class.

WindowsPowerStateMBS.BatteryCapacityChanged(Percentage as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 23.4 ❌ No ✅ Yes ❌ No ❌ No
The remaining battery capacity has changed.

The granularity varies from system to system but the finest granularity is 1 percent. The Percentage parameter that indicates the current battery capacity remaining as a percentage from 0 through 100.

Some examples using this event:

WindowsPowerStateMBS.BatteryLow

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The BatteryLow event is broadcast to notify applications that battery power is low.

Support for this event was removed in Windows Vista bei Microsoft.

Some examples using this event:

WindowsPowerStateMBS.LidSwitchStateChanged(LidState as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 23.4 ❌ No ✅ Yes ❌ No ❌ No
The state of the lid has changed (open or closed).

The event won't be called until a lid device is found and its current state is known.

0 - The lid is closed.
1 - The lid is opened.

Some examples using this event:

WindowsPowerStateMBS.OEMEvent(eventcode as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The OEMEvent event is broadcast when an APM BIOS signals an APM OEM event.

eventcode: A DWORD value that specifies the OEM-defined event code that was signaled by the system's APM BIOS. OEM event codes are in the range &h0200 - &h02FF.

Because not all APM BIOS implementations provide OEM event notifications, this event may never be broadcast on some computers.

Support for this event was removed in Windows Vista bei Microsoft.

Some examples using this event:

WindowsPowerStateMBS.PowerSettingChange(data as MemoryBlock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 23.4 ❌ No ✅ Yes ❌ No ❌ No
A power setting change event has been received.

This is the raw event with data.
We also call BatteryCapacityChanged, PowerSourceChanged and LidSwitchStateChanged events if their GUIDs are happening.

The data memoryblock contains POWERBROADCAST_SETTING data, where first 16 bytes are the GUID for the type of change. Then follows the 32-bit integer for data length and the data specific to the event.

see
https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-powerbroadcast_setting

Some examples using this event:

WindowsPowerStateMBS.PowerSourceChanged(power as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 23.4 ❌ No ✅ Yes ❌ No ❌ No
The system power source has changed.

PowerSourceAC (0) - The computer is powered by an AC power source (or similar, such as a laptop powered by a 12V automotive adapter).
PowerSourceDC (1) - The computer is powered by an onboard battery power source.
PowerSourceUPS (2) - The computer is powered by a short-term power source such as a UPS device.

Only called if you called ListenForPowerSourceChanged once.

Some examples using this event:

WindowsPowerStateMBS.PowerStatusChange

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The PowerStatusChange event is broadcast when a change in the power status of the computer is detected, such as a switch from battery power to A/C.

The system also broadcasts this event when remaining battery power slips below the threshold specified by the user or if the battery power changes by a specified percentage.

Some examples using this event:

WindowsPowerStateMBS.QueryStandby(PromptUser as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The QueryStandby event is broadcast to request permission to set the computer into standby mode.

An application that grants permission should carry out preparations for the suspension before returning.

PromptUser: If true, the application can prompt the user for directions on how to prepare for the suspension; otherwise, the application must prepare without user interaction.

Return true to deny the request, false to grant the request.

An application should process this event by first determining whether permission to go to standby mode can be granted. It must not grant permission if doing so would cause a loss of data. The application can prompt the user for directions on how to prepare for suspension only if PromptUser is set.

The system allows approximately 20 seconds for an application to remove the message that is sending the QueryStandby event from the application's message queue. If an application does not remove the message from its queue in less then 20 seconds, the system will assume that the application is in a non-responsive state, and that the application agrees to the sleep request. Applications that do not process their message queues may have their operations interrupted. After it removes the message from the message queue, an application can take as much time as needed to perform any required operations before entering the sleep state. Any operations that could take longer then 20 seconds should be performed at this time, since the system allows only 20 seconds for operations to complete during standby processing.

Some examples using this event:

WindowsPowerStateMBS.QueryStandbyFailed

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The QueryStandbyFailed event is broadcast as a notification that permission to go to standby mode was denied.

This event is broadcast if any application or driver returned false to a previous QueryStandby event.

Some examples using this event:

WindowsPowerStateMBS.QuerySuspend(PromptUser as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The QuerySuspend event is broadcast to request permission to suspend the computer.

An application that grants permission should carry out preparations for the suspension before returning.

PromptUser: If true, the application can prompt the user for directions on how to prepare for the suspension; otherwise, the application must prepare without user interaction.

Return true to deny the request, false to grant the request.

An application should process this event by first determining whether permission to suspend can be granted. It must not grant permission if doing so would cause a loss of data. The application can prompt the user for directions on how to prepare for suspension only if PromptUser is set.

The system allows approximately 20 seconds for an application to remove the message that is sending the QuerySuspend event from the application's message queue. If an application does not remove the message from its queue in less then 20 seconds, the system will assume that the application is in a non-responsive state, and that the application agrees to the sleep request. Applications that do not process their message queues may have their operations interrupted. After it removes the message from the message queue, an application can take as much time as needed to perform any required operations before entering the sleep state. Any operations that could take longer then 20 seconds should be performed at this time, since the system allows only 20 seconds for operations to complete during Suspend processing.

Support for this event was removed in Windows Vista bei Microsoft.

Some examples using this event:

WindowsPowerStateMBS.QuerySuspendFailed

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The QuerySuspendFailed event is broadcast as a notification that permission to suspend the computer was denied.

This event is broadcast if any application or driver returned false to a previous QuerySuspend event.

Support for this event was removed in Windows Vista bei Microsoft.

Some examples using this event:

WindowsPowerStateMBS.ResumeAutomatic

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The ResumeAutomatic event is broadcast when the computer wakes up automatically to handle an event.

An application will not generally respond unless it is handling the event, because the user is not present.

Some examples using this event:

WindowsPowerStateMBS.ResumeCritical

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The ResumeCritical event is broadcast as a notification that the system has resumed operation.

This event can indicate that some or all applications did not receive a Suspend event. For example, this event can be broadcast after a critical suspension caused by a failing battery.

Support for this event was removed in Windows Vista bei Microsoft.

Some examples using this event:

WindowsPowerStateMBS.ResumeStandby

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The ResumeStandby event is broadcast as a notification that the system has resumed operation after being put to standby.

Some examples using this event:

WindowsPowerStateMBS.ResumeSuspend

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The ResumeSuspend event is broadcast as a notification that the system has resumed operation after being suspended.

Some examples using this event:

WindowsPowerStateMBS.Standby

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The Standby event is broadcast immediately before the computer enters a standby state.

This event is typically broadcast when all applications and installable drivers have returned okay to a previous QueryStandby event.

Some examples using this event:

WindowsPowerStateMBS.Suspend

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Power MBS Win Plugin 6.1 ❌ No ✅ Yes ❌ No ❌ No
The Suspend event is broadcast immediately before the computer enters a suspended state.

This event is typically broadcast when all applications and installable drivers have returned okay to a previous QuerySuspend event.

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...