question

zehaochen-4445 avatar image
0 Votes"
zehaochen-4445 asked zehaochen-4445 edited

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

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-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

zehaochen-4445 avatar image
0 Votes"
zehaochen-4445 answered zehaochen-4445 edited

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.