The default way of handling the lifetime of windows in Windows is listening for a WM_CLOSE message, then deciding whether to close the window or not and optionally processing the WM_DESTROY message (for cleanup etc.) afterwards.
Is there any scenario where WM_DESTROY could be sent without WM_CLOSE beforehand? I mean "by the system", not by manually calling DestroyWindow()
or PostMessage()
. Or is it safe to rely on WM_CLOSE always being sent before WM_DESTROY?