Home > Software engineering >  VC access to Surface the power button
VC access to Surface the power button

Time:11-10

Creating software that can run on a Surface, inquired how to capture in the process of software running long power button press and press events?
The current single press the power button to enter the sleep state, long press the power button to enter to ask if shutdown interface,
I want to reach the purpose of the is:
1. In a single after pressing the power button, the computer to sleep before do some processing,
2. After the long press the power button, enter the asked if shutdown do some processing before,

CodePudding user response:

RegisterPowerSettingNotification

CodePudding user response:

reference 1st floor Jiang Sheng response:
RegisterPowerSettingNotification

Can say more specific? 1 point I can through the panel Settings allow the user to a single no response after press the power button, but can't set 2 points

CodePudding user response:

Depending on the user Settings press the button on the response of the
If press the power key to sleep, for example, to grasp PBT_APMQUERYSUSPEND
Refer to The Power - Aware Application
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms703398 (v=vs. 85)
  • Related