The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Fumbling around in the dark and stumbling across the wrong solution
Jun 13, 2006
Post comments count 0
Post likes count 0

Fumbling around in the dark and stumbling across the wrong solution

Raymond Chen
Raymond Chen

I don't mean to pick on this series of entries, but it illustrates an interesting pattern of stumbling across the wrong "solution". The series begins by attempting to trigger the system's monitor blank timeout by posting a message to the desktop window. As we saw earlier, the desktop window is a very special window and as a rule should be avoided, since it won't behave like windows created by applications. In particular, the author tried to post a message to the desktop window. This used to work in the historically open world of the window manager, but security and robustness concerns have come to take prio...

Remember what happens when you broadcast a message
Jun 12, 2006
Post comments count 0
Post likes count 0

Remember what happens when you broadcast a message

Raymond Chen
Raymond Chen

Occasionally I catch people doing things like broadcasting a message to all top-level windows. This is one of those things that is so obviously wrong I don't see how people even thought to try it in the first place. Suppose you broadcast the message What happens? Every top-level window receives the message with the same parameters, and every top-level window starts interpreting those parameters in their own idiosyncratic way. As you know (since you've written them yourself), each window procedure defines its own menu items and child windows and there is no guarantee that command 100 will mean the same th...

What happened to the traffic circle at the corner of 156th Ave NE and NE 56th Way?
Jun 9, 2006
Post comments count 0
Post likes count 0

What happened to the traffic circle at the corner of 156th Ave NE and NE 56th Way?

Raymond Chen
Raymond Chen

Windows Live Local and Google Maps both show a traffic circle at the corner of 156th Ave NE and NE 56th Way, but if you pay the intersection a visit in person, you won't find one. It was replaced with a speed bump in 2005. Why? I stumbled across the explanation completely by happenstance. There was a small article in the local newspaper that described an accident that occurred elsewhere in Redmond at a traffic circle. A car was driving down the street in excess of the speed limit and failed to negotiate the circle, resulting in the car going off the road. In the flurry of legal action that ensued, somehow the...

Why did the Add or Remove Programs control panel try to guess all that information?
Jun 9, 2006
Post comments count 0
Post likes count 0

Why did the Add or Remove Programs control panel try to guess all that information?

Raymond Chen
Raymond Chen

As we saw earlier, the "Add or Remove Programs" control panel used several heuristics to attempt to determine things like program size and frequency of user. Why did it bother doing this at all? At the time the feature was added, disk space was not cheap like it is today. One of the problems users were having was running out of disk space and not knowing what they could safely delete. Thus was born the Disk Cleanup utility, which attempted to guide the user through various things that could be deleted in order to make disk space available. In addition to cleaning up temporary files, you could also remove progr...

The forgotten common controls: The MenuHelp function
Jun 8, 2006
Post comments count 0
Post likes count 0

The forgotten common controls: The MenuHelp function

Raymond Chen
Raymond Chen

The function is one of the more confusing ones in the common controls library. Fortunately, you will almost certainly never had need to use it, and once you learn the history of the function, you won't want to use it anyway. Our story begins with 16-bit Windows. The message is sent to notify a window of changes in the selection state of a menu that has been associated with the window, either by virtue of being the window's menu bar or by having been passed as the owner window to a function like . The parameters to the message in 16-bit Windows were as follows: The function parsed the parameters of the ...

Disaster averted, thanks to undisclosed government action, no really
Jun 7, 2006
Post comments count 0
Post likes count 0

Disaster averted, thanks to undisclosed government action, no really

Raymond Chen
Raymond Chen

On his web site, http://www.savelivesinmay.com, Eric Julien predicted that (and I hope I got this right) on May 25, 2006, comet fragments generated in 1995 by a hostile extraterrestrial civilization would impact the Atlantic Ocean near the Azores, followed by volcanic eruptions which would create a giant tsunami that would wipe out the East coast of the United States. As the fateful day approached, the predicted date turned into a 48-hour window, and then triumphant relief that the United States government heeded his warning and prevented the tsunami from striking. But we're not out of the woods yet. "A...

If you're going to try to simulate user actions, make sure the user can do them
Jun 7, 2006
Post comments count 0
Post likes count 0

If you're going to try to simulate user actions, make sure the user can do them

Raymond Chen
Raymond Chen

Many people like to simulate user actions programmatically. I'm not going to comment here on whether that's a good idea to begin with; what I want to point out is that if you're going to do it, you have to make sure you're simulating things the user can actually do. For example, if you want to act as if the user clicked the "close" button in the corner, you have to make sure that the window is visible and enabled and that the window even has a "close" button to begin with! Failing to observe these rules means that the application you are manipulating is going to experience "impossible" conditions. The window ma...

Apparently driving is messed up in a lot of countries
Jun 6, 2006
Post comments count 0
Post likes count 0

Apparently driving is messed up in a lot of countries

Raymond Chen
Raymond Chen

From the reactions to my entry on driving in Taiwan, it appears that driving is pretty messed up all over Asia. Here's a video of driving in India that was popular a while back. This comment comparing Taiwan driving to the Philippines reminded me of a conversation I had with some Filipino tourists when I was in Taiwan. We were on a bus as it was negotiating traffic, and I asked them, "Is driving in the Philippines as crazy as here in Taiwan?" They answered, "Oh, no. It's much crazier."

The forgotten common controls: The page scroller
Jun 6, 2006
Post comments count 0
Post likes count 0

The forgotten common controls: The page scroller

Raymond Chen
Raymond Chen

The pager control was introduced with the common controls library that came with Internet Explorer 4.0 in order to assist in implementing scrolling menus on the Start menu and Favorites menu. (The Start menu and Favorites menu aren't really menus in the Win32 sense. They are custom controls written to act like menus; the fakemenu sample provides the basic idea.) The menu part is wrapped inside a pager control, and it is the pager that provides the scrolling behavior. It so happens that scrolling menus were a bad idea. User feedback after the release of Internet Explorer 4.0 rather decisively indicate...