How can I intercept the push of the physical power button in Windows?
Is there any way to intercept the event of the physical power button being pressed in order to react to this event? i.e.: Push button -> My program catches the event -> My program performs action. My goal is to write a C# program/service that will listen for the power button event and then open the "Ask me what to do" shutdown dialog (Like it did back in the days of Windows XP). You could use SystemEvents.SessionEnding Event However I am not sure if this will work if the power button is pressed, this event Occurs when the user is trying to log off or shut down the system. I can explain it to