Windows System Message Collection-Gradual update in

Source: Internet
Author: User

1.wm_queryendsession

This message does not allow the application to exit directly, the message is primarily to ask if the application is ready to exit, and when all applications return true to the message, the system logs off or shuts down. If you want to quit the program, use the WM_CLOSE message!

Windows broadcasts a message wm_queryendsession to all the top-level windows when it shuts down, and its lparam parameter can distinguish between shutting down or logging off the user (lparam is endsession_logoff when logging off the user). Then Windows waits for all applications to return true for this message before it shuts down.

Therefore, as long as the main form of our application returns False,windows to this message, it will not shut down.

But it is not absolutely possible to prevent Windows from shutting down, because if an application calls ExitWindowsEx (ewx_poweroff| ewx_force,0); To shut down, I can not stop this program, because that call ExitWindowsEx, the system will not issue wm_queryendsession messages, the program will not prevent Windows shutdown.

2.wm_endsession

Windows sends Wm_endsession messages to each window message handler that previously received wm_queryendsession messages. If Windows cannot shut down the system because another program has returned 0 from Wm_queryendsession, then Wm_endsession's wparam parameter is 0. The wm_endsession message actually answers the question: I told Windows to end it, but did I really end it?

Windows System Message Collection-Gradual update in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.