WM_ENDSESSION
fEndSession = (BOOL) wParam; /* end-session flag */
The WM_ENDSESSION message is sent to an application that has returned a nonzero value in response to a WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is actually ending.
fEndSession
Value of wParam. Specifies whether the session is being ended. It is TRUE if the session is being ended; otherwise, it is FALSE.
An application should return zero if it processes this message.
If the fEndSession parameter is TRUE, Windows can terminate any time after all applications have returned from processing this message. Therefore, an application should perform all tasks required for termination before returning from this message.
The application does not need to call the DestroyWindow or PostQuitMessage function when the session is ending.
DestroyWindow, ExitWindows, PostQuitMessage, WM_QUERYENDSESSION