The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

How do I enable and disable the minimize, maximize, and close buttons in my caption bar?

A customer was having problems with the small icon that appears in the upper left corner of the caption: In my program, I need to enable and disable the Close button programmatically, since the program sometimes goes into a state where I don't want the user to close it. I do this by removing the style when I want to disable the Close button, and adding it back when I want to re-enable it. However, doing this has as a side effect that the icon for my program doesn't appear in the title bar any more. If I never touch the style, then it works fine (but then I don't get the enable/disable behavior that I want). ...

The voice of Carl Kasell emerges from the loudspeaker as some old guy stands there and moves his mouth

Some time ago, the NPR news quiz Wait Wait... Don't Tell Me taped a show in Seattle. (They're back in town tonight.) I was fortunate to score tickets to that show, in part because I ordered them nearly a full year before taping. Watching the taping of the show is quite a treat, and I recommend it for any fan of the program. You can watch Peter Sagal pace back and forth as he talks and contrast it to old-school radio man Carl Kasell, who stands perfectly still as he delivers his lines. The strangest part of the experience was putting the face to the voice. When Carl Kasell started talking, my reaction was, "Hey...

How do I convert an ANSI string directly to UTF-8?

A customer asked the following question: Is there a way to convert an ANSI string directly to UTF-8 string? I have an ANSI string which was converted from Unicode based of the current code page. I need to convert this string to UTF-8. Currently I am converting the string from ANSI to Unicode () and then converting the Unicode to UTF-8 (). Is there a way to do the conversion without the redundant conversion back to Unicode? There is no multibyte-to-multibyte conversion function built into Windows (as of this writing). To convert from one 8-bit encoding to another, you have to use Unicode as an intermediate ...

The giant typewriter eraser in the Olympic Sculpture Park in Seattle

The Olympic Sculpture Park in Seattle is open and free to the public all year around. (And I'm surprised they haven't gotten the heat from the IOC over use of the word Olympic.) One of the works is a giant typewriter eraser. When my friend took her niece (I'm guessing around ten years old at the time) to visit the park, the girl asked, "What's that?" — Oh, that's a typewriter eraser. Back before Wite-Out or eraser ribbons, this was how you corrected mistakes. This end is the eraser, and you use that end to brush the crumbs off. The next question was unexpected, but in retrospect, inevitable. "What's...

Puzzle: Can you explain this program's crash profile?

Some time ago, I was asked to help a customer study a set of crashes that had been collected by Windows Error Reporting. (You too can sign up to obtain access to crash data for your application.) The issue itself was the 325th most common crash in the ISV crash database, so fixing it would mean a lot toward improving the overall perceived stability of Windows. Fortunately, the issue was resolved relatively easily, but that's not what made the story interesting. What I found interesting was a little puzzle that faced me when I called up their crash profile. One of the items in the crash profile report is a histog...

Why doesn't the Windows Vista copy progress dialog show the names of the files being copied?, redux

As expected, everybody concluded that the Windows Vista copy progress dialog made every wrong decision possible. Let's look at some of the suggestions on making it suck less: Why not update the file name every five seconds to the file that is being copied at that time? Sure, you could do that, but the cost of getting the name is part of the problem. Retrieving the name is more than just "Remove everything after the last dot." You may have to look up localization information in order to display the name of the item in a manner appropriate for the user's preferred language. Since the operation being performed mi...

Welcome to the maze and enjoy the Habitrail

Last year, Microsoft Press and Microsoft Learning moved to new buildings in downtown Bellevue, bidding good-bye to The Maze. This was a nickname for their former building I had been unfamiliar with, but not having been to their building, I can't say whether the name is deserved or not. What I do know, however, is that the small cluster of buildings they moved from are connected by enclosed walkways, which are nicknamed the Habitrail due to their startling similarity to the hamster transportation tubes. Back in the old days, these corridors were lined with stand-up arcade consoles, owned by the people who work i...

That's a great idea, it's on the list

The great thing about the taskbar is that everybody and their pet dog have an idea for how it can be improved. The bad thing about the taskbar is that everybody and their pet dog have an idea for how it can be improved. (And everybody and their pet dog also think that their feature suggestion is the important one that should be worked on next. Especially if it's "just a tiny little feature.") For a few years, my office sat across the hall from the person responsible for the taskbar design and features. To help manage all the wonderful ideas that came in, my colleague maintained a spreadsheet of all suggestions ...

How do I accept files to be opened via IDropTarget instead of on the command line? – bonus content

One of my colleagues tipped me off to some additional resources on the subject of using the DropTarget technique for accepting files for execution. First, it turns out that there is an SDK sample that demonstrates the DropTarget technique after all. This sample is fifteen years late according to one commenter who apparently thinks that the Platform SDK needs to provide a sample for a feature that won't be invented for another twelve years. Maybe we can use the Microsoft Research project to predict the future. No wait, we also need to get them to invent the time machine so we can take the future-predictor ma...