The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
What does the minus sign in indirect localized string resources mean?
The syntax for indirect localized string resources is filenamestringId, optionally followed by a semicolon and a comment. A customer wanted to know what the minus signs stands for. The minus sign doesn't "stand for" anything. It's just part of the syntax. It's like asking what the semicolon at the end of a C statement stands for. It doesn't stand for anything; it's just part of the rules for C statements. (And if the minus sign has to stand for something, what does the comma stand for?) Okay, so maybe the question was really "Why does the syntax for indirect localized strings include a minus sign? Isn't the co...
Instead of creating something and then trying to hide it, simply don't create it in the first place
A customer had a question, which was sort of I bet somebody got a really nice bonus for that feature in reverse. A customer is asking if there is a way to programmatically control the icons in the notification area. Specifically, they want the setting for their notification icon to be "Only show notifications" rather than "Show icon and notifications" or "Hide icon and notifications." Fully charged (100%) Network Fabrikam Internet access Volume Speakers: 10% Contoso Resource Notification No new resources found. It's a good thing th...
Why don't music files show up in my Recent Items list?
If you double-click a music file, it doesn't show up in your Recent Items list. What's so special about music files? The technical reason is that the file types are registered with the flag, which means that they don't show up in the Recent Items list (formerly known as Recent Documents), and they don't show up in the Recent or Frequent section of Windows Media Player's Jump List. Okay, fine, but that's like answering "Why is there a door here?" with "Because the blueprints said that there should be a door there." You really want to know why the architect decided to put a door there. The reason why music fil...
What's the difference between Text Document, Text Document – MS-DOS Format, and Unicode Text Document?
Alasdair King asks why Wordpad has three formats, Text Document, Text Document - MS-DOS Format, and Unicode Text Document. "Isn't at least one redundant?" Recall that in Windows, three code pages have special status. Three text file formats. Three encodings. Hm... I wonder... As you might have guessed by now, the three text file formats correspond to the three special code pages. Now it's just a matter of deciding which one matches with which. The easiest one is the Unicode one; it seems clear that Unicode Text Document matches with Unicode. Okay, we now have to figure out how Text Document and Text Doc...
How do I find out which process has a file open?
Classically, there was no way to find out which process has a file open. A file object has a reference count, and when the reference count drops to zero, the file is closed. But there's nobody keeping track of which processes own how many references. (And that's ignoring the case that the reference is not coming from a process in the first place; maybe it's coming from a kernel driver, or maybe it came from a process that no longer exists but whose reference is being kept alive by a kernel driver that captured the object reference.) This falls into the category of not keeping track of information you don't n...
Why does the DrawIcon function draw at the default icon size?
Miral wondered why the function draws at the default icon size instead of respecting the actual icon size. After all, if you loaded a nonstandard-sized icon via , then presumably you want to use that nonstandard size. The question is one of those types of questions that fails to understand history, like asking why NASA didn't send the space shuttle to rescue the Apollo 13 astronauts. At the time the function was written, the function didn't exist, and wouldn't exist for over a decade. The function showed up in Windows 95, but Windows was drawing icons long before then, and for a long time, the on...
When does an icon handler shell extension get unloaded?
A customer had a question about the function. They used the function to obtain the icon for a file, and they discovered that when they asked for the icon of a particular type of file, the shell extension for the associated application was loaded. But unfortunately the third party shell extension is not getting unloaded, maybe because of a bug. Can we do anything in code to get this shell extension to unload? You already know everything you need to answer this. Shell extensions are COM objects, and icon handlers are in-process local servers, and in-process local servers remain loaded until the apartment is t...
The awesome Valentine's Day gift disguised as an uncreative one
A few years ago, one of my colleagues wanted to surprise his wife with a new laptop for Valentine's Day. (As a bonus, he set the wallpaper to one of their wedding pictures.) Now, he could just give her a neatly wrapped laptop, but he wanted this one to be a super-surprise. First, he bought a large box of chocolates. He then carefully opened the box (preserving the bow and other wrapping), removed the chocolates and put the laptop inside, using a smaller box of chocolates to act as packing material. He then put the cover back on the box of chocolates and restored the box to its original unopened appearance. As a...
Why did the Windows 95 Start button have a secret shortcut for closing it?
Unintentional consequences.