October 21st, 2024

Why does adding WS_MINIMIZE­BOX change how my window behaves when the user presses Win+D?

A customer noticed that if they add the WS_MINIMIZE­BOX style to their window, then the IsIconic function returns a nonzero value after the user presses Win+D. But if they remove the WS_MINIMIZE­BOX style, then then the IsIconic function always returns FALSE. What’s going on?

We learned some time ago that the Show Desktop command Win+D first minimizes all windows that can be minimized, and then moves the desktop window to the top of the z-order.

Therefore, the described behavior is expected: If the window has the WS_MINIMIZE­BOX style, then it can be minimized, so the Show Desktop command minimizes it, and the IsIconic function reports that the window is indeed minimized. On the other hand, if the the style is missing, then the window cannot be minimized, so the IsIconic function reports that the window is not minimized.

Bonus chatter: But why is the function called IsIconic when it really reports on whether the window is minimized? Shouldn’t it be called IsMinimized? What is an “iconic” window anyway? Is it a window that is widely recognized as representative for its era?

No. The reason is simple: Before the taskbar was invented, minimized windows were represented by an icon. So the name “is iconic” was correct at the time.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

1 comment

  • Boris Zakharin

    Way to make me feel old for actually remembering what the desktop was like before the taskbar. However, I don’t remember minimized windows being called “iconic”, so IsMinimized seems to be a better name for it than IsIconic even at the time.