Why is the HSHELL_WINDOWDESTROYED notification raised when a window is hidden, e...
source link: https://devblogs.microsoft.com/oldnewthing/20201228-00/?p=104610
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Why is the HSHELL_WINDOWDESTROYED notification raised when a window is hidden, even if it hasn’t been destroyed?
Raymond
December 28th, 2020
The shell notification HSHELL_WINDOWCREATED
means that there is a new top-level unowned visible window. Conversely, HSHELL_WINDOWDESTROYED
means that a window is no longer a top-level unowned visible window. But these state changes can occur for reasons other than a window being created and destroyed. For example, if a top-level window hides itself, then that will generate a HSHELL_WINDOWDESTROYED
notification, even though no window was destroyed.
Why don’t the names align with what they mean?
These notifications were named while wearing taskbar-colored glasses.
These notifications were created to assist the taskbar in keeping track of the windows in the system. The taskbar shows top-level unowned visible windows, so that’s what the notifications pay attention to. If you hide a top-level unowned window, it hasn’t been destroyed, but it may as well have been destroyed as far as the taskbar is concerned: The window disappears from the taskbar.
Conversely, when the window becomes visible again, it gains a taskbar button. As far as the taskbar is concerned, it may as well have been newly-created.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK