How to capture system shutdown events

xiaoxiao2021-03-06  55

In the case of shutdown or logff, if we shut down or logoff, our programs sometimes can't end according to the normal program, usually we have to do at the end of Form's unload, but if the user is directly The shutdown of the start function menu will not do the part of Unload, and we now think about the information when shutdown (or logoff). In general, when shutdown or logff, Windows will pass the information of WM_QueryEndSession to each process, if there is a processs in the middle, if there is no deployment after Word modification, but we will cancel it At this time, the result of this information will be transmitted back to false (0), and Windows will no longer continue to send WM_QUERYENDSession to the next Proccess. Conversely, if all processs can be successfully ended (that is, each sent WM_QUERYEENDSESSSION is transmitted back), that is only to end. Regardless of the last result of the WM_QueryEndSession, Windows will be sent again or not, Windows will be sent smoothly or unable to end.

A WM_ENDSESSION information gives all process, and the content of WPARAM is to point out if it can be smooth.

转载请注明原文地址:https://www.9cbs.com/read-117901.html

New Post(0)