The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

May 12, 2009
Post comments count 0
Post likes count 1

Microspeak: T-shirt sizing

Raymond Chen

Larry Osterman discussed the buzzword T-shirt sizing, which means "making extremely rough estimates in terms of a small number of predefined categories." The term comes from the traditional way T-shirt sizes are specified in the United States. Instead of having T-shirts in sizes 4, 5, 6 and so on, there are only a small number of sizes: Small, medium, large, and extra-large. (Sometimes augmented by extra-small, extra-extra-large, etc.) Forcing the estimate into one of a fixed set of sizes allows the process to go quickly while still producing a result that is at least within the same zip code as a more detaile...

May 11, 2009
Post comments count 0
Post likes count 2

How do I get a window back on the screen when it moved far, far away?

Raymond Chen

Commenter Aggravated notes that some programs remember their location when the window is closed and restore to that location when the window is reopened, even if that position is off the screen. These programs clearly were using screen coordinates instead of workspace coordinates to save and restore the window. Okay, so you've got a program that restored its window position incorrectly and ended up putting it off the screen. Now what do you do? The keyboard interface comes to the rescue. Switch to the application, say by clicking on its taskbar button or by Alt+Tab'ing to it. Then type Alt+Space to call...

May 8, 2009
Post comments count 0
Post likes count 1

Writing a sort comparison function, redux

Raymond Chen

Prerequisites: Experience with sort functions such as qsort. Overqualifications: Familiarity with sort algorithms. If you break the rules for sort comparison functions, then don't expect the result of a sort call to be meaningful. In fact, if you really mess it up, you can corrupt memory or go into an infinite loop. My program hangs when I used this sort comparison function (pseudocode): int compare(x, y) { return x >y ? +1 : -1; } What's even more strange is that sometimes instead of hanging, the program crashes. It all works correctly if I add one line: int compare2(x, y) { if (x == y) retur...

May 7, 2009
Post comments count 0
Post likes count 0

A puzzle: Why are so many fake LiveJournal blogs written by 29-year-olds?

Raymond Chen

NPR's All Tech Considered blog notices a huge spike of LiveJournal users who claim to be 29 years old. They conclude (almost certainly correctly) that these are all fake journals created by spam bots. But why 29 years old? One possible answer.

May 7, 2009
Post comments count 0
Post likes count 1

When you subclass a window, it’s the original window procedure of the window you subclass you have to call when you want to call the original window procedure

Raymond Chen

When you subclass a window, you set the window procedure to a function of your choosing, and you remember the original window procedure so you can pass it to the CallWindowProc function when your subclass function wants to pass the message to the original window procedure. For example, if you subclass a window like this: SubclassWidgetDialog(HWND hdlgWidget) { HWND hwndButton = GetDlgItem(hdlgWidget, ...); wndProcOrig = (WNDPROC) SetWindowLongPtr(hwndButton, GWLP_WNDPROC, (LONG_PTR)SubclassWndProc); // -or- // wndprocOrig = SubclassWindow(hwndButton, SubclassWndProc); ... } then your subclass ...

May 6, 2009
Post comments count 0
Post likes count 0

You can tell which people listed blogging as a performance review goal

Raymond Chen

I had been kind of baffled by some of the Microsoft employee blogs that appear to consist almost entirely of rehashes of Knowledge Base articles, or sometimes even just "A new Knowledge Base article on topic X has been published." Now, that's useful information to have if you're interested in topic X, but is it really something you can build a blog around? Can't you just sign up for KB notifications manually? (That's probably how the blog author found them anyway.) And then there are the head-scratcher blog entries like There are no new KB articles this week. But I never really thought too much abou...

May 5, 2009
Post comments count 0
Post likes count 1

The social skills of a thermonuclear device: Why did you hang up?

Raymond Chen

One morning I'm working in my office and I'm interrupted by a telephone call. The caller-ID shows that it came in through the switchboard. (I.e., somebody called the main Microsoft number and asked for me by name.) Me: Hello? Caller: [angrily] Mr. Chen, why did you hang up? I don't recognize the voice, and I haven't received a phone call in several days, so I have no idea who this person is or what he's talking about. But if somebody starts out rude to me, that doesn't put me in the friendliest of moods. Still, I use a polite tone of voice. Me: Oh, I'm sorry. I'll do it again. [click] A few minutes ...

May 4, 2009
Post comments count 0
Post likes count 1

The dummy icon that doesn’t know that its fifteen seconds are over

Raymond Chen

Commenter Myron A. Semack asks via the Suggestion Box why there is a hardware notification icon that doesn't do anything. This is the notification icon that is left behind if you dismiss the hardware notification balloon. I don't know, but I can figure it out based on information both you and I already know. First of all, notice that the only way to show a notification balloon is to associate it with a notification icon. After all, the tip of the balloon has to point to something. Therefore, it's not surprising that when the balloon shows up, a notification icon also appears. You can't display "just a ball...

May 1, 2009
Post comments count 0
Post likes count 1

When advanced users outsmart themselves: The device removal notification icon

Raymond Chen

A customer submitted a suggestion to the user interface team about the device removal notification icon. The device removal notification icon is far too hard to use. When I click on it, I get a menu that says Safely Remove Hardware, and when I click on that menu item, I get a dialog box that lists all the removable devices, with vague names like USB Mass Storage Device and propeller-beanie details like Connected on Port 0006, Hub 0004. When I click the Display device components check box, I'm presented with a tree view of hardware devices that only a geek could love. This is far too complicated. When I click...