How to prevent the end program pop-up window when shutting down

zehao chen 1 Reputation point
2022-05-21T01:33:50.46+00:00

When the power off key is pressed, there is a program to prevent shutdown, by controlling the shutdown option in gpedit.msc, there are two different behaviors.
One is an immediate end pop-up window, One is that the shutdown interface appears and the shutdown application interface appears.
I want to close these two behaviors. Prevent pop ups or those two interfaces from appearing
My goal is that when I press the power button, the pop-up window of my application prompts the user whether to shut down, not affected by system behavior
What should I do? Thanks
204301-dingtalk-20220521161728.jpg204302-dingtalk-20220521161734.jpg

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,616 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. zehao chen 1 Reputation point
    2022-05-21T01:56:44.79+00:00

    My application listens for WM_QUERYENDSESSION messages for pop ups. I'm sure it was the shutdown message sent to the csrss.exe process that caused the immediate end popup.
    My other idea is there any way to notify my application by other means when the power key is pressed? By setting the behavior of pressing the power button in the power option setting and listening to some other message.

    0 comments No comments