Date: | February 10, 2005 / year-entry #35 |
Tags: | history |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20050210-00/?p=36483 |
Comments: | 31 |
Summary: | We discussed a few months ago the issue of where windows minimized to before the taskbar was invented. In the modern taskbar world, why do minimized windows have an apparent size of 160×31? The size isn't just apparent. That's really their size. You can see them, for example, if you fire up a program that... |
We discussed a few months ago the issue of where windows minimized to before the taskbar was invented. In the modern taskbar world, why do minimized windows have an apparent size of 160x31? The size isn't just apparent. That's really their size. You can see them, for example, if you fire up a program that uses the Multiple Document Interface. Observe the appearance of the window "Book1". This is a minimized window (though minimized to its MDI host rather than to the desktop). With the introduction of Windows Explorer, which put files on the desktop in the form of icons, it became necessary to change the appearance of minimized windows in order to avoid confusing a minimized program icon from a desktop icon. A minimized program, therefore, took the form of a miniature title bar. The programming interface to minimized windows remained the same, for compatibility reasons. (And please let's just agree to disagree on whether backwards compatibility is a good thing or not.) That's why the function to tell whether a window is minimized continues to be called The |
Comments (31)
Comments are closed. |
"With the introduction of Windows Explorer, which put files on the desktop in the form of icons, it became necessary to change the appearance of minimized windows in order to avoid confusing a minimized program icon from a desktop icon."
Except that when you’re using Explorer as the shell, you never get to see any minimized windows at all. Explorer silently moves minimized windows to some far off-screen position so that they can’t be seen. Instead, the user gets Taskbar buttons, which somewhat resemble the minimized windows they represent.
If you want to see the actual minimized Windows, you can kill Explorer, or shut it down using the old Ctrl+Alt+Shift+Cancel trick in the "Shut Down Windows" dialog box. You’ll then have to restore and re-minimize the windows to reset their minimized positions back on-screen.
Given this, I suspect that the appearance of minimized windows was redesigned primarily for the benefit of MDI.
Right. This set of blog posts if normally really great, and even though this one is too, I’m a bit disappointed that it does not answer the question it posed itself. (Which I have come to expect of them.)
"In the modern taskbar world, why do minimized windows have an apparent size of 160×31?"
Indeed: why exactly 160×31 and not a slightly different size? ;-)
Even if you use Explorer as your shell, you can get one of these little gizmos on your desktop: Minimize a window whose window styles say "Don’t put me on the taskbar".
"The programming interface to minimized windows remained the same, for compatibility reasons. (And please let’s just agree to disagree on whether backwards compatibility is a good thing or not.)"
I’m getting to be more than a little annoyed, Raymond, at the legions of programmers out there that think it’s ok to just break every app out whenever they come up with a new idea. What is the basis for this mentality?
James
Isn’t it something other than 160×31 if you play with your font/dpi settings?
Hey Raymond,
why is OpenIcon and CloseWindow not on the "Obsolete Windows Programming Elements" list?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/obsolete_windows_programming_elements.asp
“Isn’t it something other than 160×31 if you play with your font/dpi settings?”
Yes. Additionally, you can adjust the width to your liking by editing the “MinWidth” value in the following registry key:
HKEY_CURRENT_USERControl PanelDesktopWindowMetrics
Explorer also uses this setting to determine the default width of Taskbar buttons. One of the first things I do after a fresh Windows install is to increase this value to give me nice, wide Taskbar buttons that don’t needlessly cut off the caption text.
Funny, I was just thinking about this a couple days ago. I had been working in VC for a while, and I went to switch to an Explorer window that had been minimized for a while (and thus swapped out to disk). Explorer did its little animated title bar thing, and when the window first painted, it was clearly just a little chunk of the title bar. Now I know it was exactly a 160×31 chunk.
Then about a second later, enough stuff was swapped back in to let the window resize & repaint in its restored size, and I got back to work. ;)
"why is OpenIcon and CloseWindow not on the ‘Obsolete Windows Programming Elements’ list?"
I’m not Raymond, but I think it’s because the functions have not been superseded. Although the names are now anachronistic and misleading, the functions still work just fine.
James, nobody thinks it’s ok to break applications willy nilly. But a lot of us think it’s ok to break applications that rely on undocumented or even flat out buggy behavior.
Idunno, I like breaking AOL CDs in half. :P
Vorn
If I use ShowWindow(hwnd, SW_MINIMIZE) on some windows (i.e. VS.Net 2002 or some Delphi apps) they are not minimized to the taskbar but they become 160×31 windows on the desktop. The minimize button works correctly. Why?
mb: You’ll have to debug those programs to see what it’s doing. My guess: They have custom behavior for WM_SYSCOMMAND/SC_MINIMIZE.
Jerry,
I see your point. The part that really puts me on life support is how we just can’t seem to do anything about it.
James
<a href="http://weblogs.asp.net/oldnewthing/archive/2004/10/28/249044.aspx#249067">I intend to discuss this further on February 10th, 2005.</a>
Now thats forward planning.
Cooney,
Well said!
James
I think backwards compatibility is a GREAT thing. A lot of the data I collect in various programs is like a part of my brain now, and I’ll really need it in 50 years when I start losing my memory. So I want my 2005 programs to keep running on Windows 2050.
About the Delphi minimizing thing.
Delphi applications have (or used to have) actually two windows open. One very small, placed outside the visible screen and the actual, usable window.
The reason is, if I remember correctly, that the Delphi TApplication class needs it as a specific basewindow.
If you want great backwards compatibility, try Unix or Linux. C programs I wrote in 1978 still compile today. They still don’t do anything useful though…
"That’s why the function to tell whether a window is minimized continues to be called IsIconic, the…"
windowsx.h helps with this "mess":
#define IsMinimized(hwnd) IsIconic(hwnd)
#define IsMaximized(hwnd) IsZoomed(hwnd)
#define IsRestored(hwnd) ((GetWindowStyle(hwnd) & (WS_MINIMIZE | WS_MAXIMIZE)) == 0L)
:-)
Regardless of whether or not open source is a viable business practice, there is probably something to be said for the release of source code when a product is no longer supported.
Dave: Many businesses have old but business-critical apps which they can’t recompile because they haven’t got the source (quite likely the vendor is no longer in business). New versions of Windows have to be compatible with the *binaries* of old apps, not just the source.
"New versions of Windows have to be compatible with the *binaries* of old apps, not just the source."
My 1978 binary would work too if I still had a VAX 11/780. That’s where having the source comes in handy, I can run it on a Pentium instead.
My point in saying "still compiles" was that the APIs that Unix (and Linux) supplied in 1978 are still availble and work today. But the ability for Unix to change hardware platforms certainly has come in handy from then to now. Given how much code is locked into x86 architectures today it’s probably not much of an issue for the future though.
2/10/2005 7:26 AM J. Edward Sanchez
> Except that when you’re using Explorer as
> the shell, you never get to see any
> minimized windows at all. Explorer silently
> moves minimized windows to some far off-
> screen position so that they can’t be seen
In addition to the intended exceptions mentioned by one or two others, there are also the exceptions that came up daily in Windows 98 and a few random times in XP. When clicking on a button in the taskbar fails to properly restore a window, the window remains off-screen but can be moved back on-screen by moving it. At that time its size looks like 160×31, and it is drawn upside-down and/or backwards. Resizing can restore its size from negative to positive. Usually the corrupted window was Internet Explorer, but not always.
Does this got anything to do with the bug of remaining taskbar buttons (e.g. of the screensaver)
PS I can’t find the MinWidth value on XP registry
I discussed that problem last year. http://weblogs.asp.net/oldnewthing/archive/2003/12/29/46371.aspx
The blot: If you don’t have the "MinWidth" value, you can create it yourself. It should be of type REG_SZ, and contain the desired value expressed in negative twips. (A twip is 1/1440 of a logical inch.)
For example, if you have your display set to "Normal size (96 DPI)", and you want your taskbar buttons to be 512 pixels wide, you should set "MinWidth" to "-7680". (Take 512, divide by 96, and then multiply by -1440.)
Log off and back on for it to take effect.
I haven’t tested this, but I believe that if you set "MinWidth" to a positive value, it is simply interpreted as the desired width in pixels. Even if this is true, however, it’s still more elegant to specify it in twips, which are device-independent.
"MinWidth" is briefly documented here:
http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/regentry/58825.asp
Note that the default value given on that page is clearly erroneous. A value of "-154" (154 twips) works out to just ten pixels at 96 DPI, which is absurdly low. The default value is actually "-2310" (2310 twips), which works out to exactly 154 *pixels* at 96 DPI.
BTW, the apparent discrepancy between 154 and the 160 that Raymond quotes can be accounted for by the window border, which is three pixels wide on each side by default. In the screen shot above, the dark gray portion of the "Book1" minimized document window is exactly 154 pixels wide.
It’s the size of a caption.