A customer noticed that if they add the WS_
style to their window, then the IsIconic
function returns a nonzero value after the user presses Win+D. But if they remove the WS_
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_
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.
windowsx.h to the rescue. It defines IsMinimized for IsIconic (and IsMaximized for IsZoomed).
I will grudgingly admit that not every win32 developer lived thru the 3.1 era, but surely they are aware of it, at least?
I always thought the “iconic” representation in w95+ versions looks really weird. I suppose the expectation is that nobody would ever see it, but in truth explorer.exe does crash now and then (mostly then, not so much now).
They're also visible when child windows are minimized. As you can see in program manager as well. https://github.com/bhuebschen/Program-Manager
It's basically the default way the window manager in windows handles iconification. Except explorer intercepts that request, shoves them off screen and hides them.
Personally, I prefer the Win3.x method because I can see exactly what's running on screen. But there's challenges to running windows without explorer, namely shell integration. Metro programs depend on explorer for whatever reason....
And don’t forget that Program Manager was still available in Windows 95 as an alternative to Explorer. Those icons looked very weird indeed.
Kill explorer.exe for the legacy iconic minimize to the bottom left corner. You can even double click on the program icon to restore.
I discovered that setting the WS_EX_NOACTIVATE extended window style via SetWindowLongPtr can achieve a similar effect.
When WS_EX_NOACTIVATE is set, the window cannot be activated by clicking with the mouse, and the window won’t show up in Alt+Tab or the taskbar by default, but it can still receive mouse messages.
If you click the minimize button, the window will minimize to an icon in the lower-left corner, and you can activate the window from the...
You get something similar to the old behavior, but they minimize to a bar with an icon and restore, maximize, and close buttons. That’s how it’s been since Windows 95. The pre-Windows 95 behavior had just icons on the desktop when minimized.
Yeah. If you iterate through the chicago builds you can see how that evolved. They took the original full size icons, added a window frame around it, and shifted the text to the right. Then eventually scaling the icon down, adding the caption buttons, and making it match the look of the regular windows. The original functionality is still there, even with the extra stuff that was added over time.
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.
I guess one needs to go back to Windows 1.0. According to the emulator at https://www.pcjs.org/software/pcx86/sys/windows/1.01/ega/ , the system menu option at that time was called Icon.