The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Aug 22, 2008
Post comments count 0
Post likes count 1

Destroying the module and resource information associated with an icon

Raymond Chen

We've seen that icons and cursors know where they came from, and the window manager uses this information when you ask it to change the size of an icon. But not all icons carry this information, only icons created by passing a HINSTANCE and a resource name. You can use this to your advantage if you want to destroy the module and resource information associated with an icon. For example, the CreateIconIndirect function creates an icon from raw bitmap information without reference to an HINSTANCE or a resource name. This allows you to create icons at runtime, but it also allows you to create an icon that "throw...

Aug 21, 2008
Post comments count 0
Post likes count 0

Oh no, there’s fog in San Francisco!

Raymond Chen

My flight out of Seattle on Wednesday was delayed for about an hour. The explanation: Fog in San Francisco. Whoa, fog in San Francisco. Must've taken them by surprise!

Aug 21, 2008
Post comments count 0
Post likes count 1

Why does Explorer generate a page fault every two seconds?

Raymond Chen

If you fire up Task Manager and look at the page fault count, you'll see that even when nothing is going on, Explorer takes a page fault every two seconds. Isn't this bad? I though you weren't supposed to poll. Here's an interesting experiment: Change your update speed to High. Wow, the page fault rate quadruples to a page fault every half second. At this point, you should start suspecting some sort of Heisenbehavior, that is, that the behavior of the system is changing due to your act of observing it. The page faults are coming from the CPU meter in the notification area. At each update, Task Manager sets ...

Aug 20, 2008
Post comments count 0
Post likes count 0

When somebody says a game is like chess, it is usually completely unlike chess

Raymond Chen

Chess has become elevated to the gold standard of board games. Everybody wishes their game had the cultural gravity of chess, a game whose mere mention elevates you to the category of deep thinker and profound strategist. (We'll set aside the scrawny glasses-wearing nerd part for now.) I've learned that when somebody says a game is like chess, it's pretty much guaranteed that the game in fact bears no resemblance to chess whatsoever. I came to this realization when somebody pulled out a game with a strange-looking board with what looked like plastic volcanoes glued to the surface, catwalks, and a lazy susan....

Aug 20, 2008
Post comments count 0
Post likes count 1

Icons and cursors know where they came from

Raymond Chen

If you create an icon by calling , the window manager loads the specified icon from the module you specified, but it also remembers where the icon came from. (This discussion also applies, mutatis mutandis to cursors, but I will just talk about icons to avoid awkardness.) When you pass the flag to the function, the window manager goes back to the original icon source to create the copy you requested rather than blindly stretching the pixels of the icon you passed in. Remember that an ICO file represents not just one icon but rather a collection of icons (known as an "icon group"), each at a different size or ...

Aug 19, 2008
Post comments count 0
Post likes count 0

It’s not Christmas: Nobody enjoys unwrapping your present

Raymond Chen

I don't know why it happens, but it happens with disturbing frequency. A customer wants to report a problem, and then illustrate it with a screenshot or two, but instead of attaching the screenshots, they paste the screenshots inside a Word document (and for some reason it's always Word) and then attach the Word document. It's not a Christmas present. People aren't going to say "Wow, I wonder what's inside? I'm brimming with anticipation!" They're going to say, "Oh great, I can't even see the screen shot. I have to download the attachment, scan it for viruses, then load it into Word. Oh wait, this is a Word 200...

Aug 18, 2008
Post comments count 0
Post likes count 0

As a courtesy to performers and other audience members, please turn off blinking head-mounted devices

Raymond Chen

When a theater or concert performance begins, there is often an announcement asking audience members to silence their cell phones and similar devices. Some time ago, a light blinked near the ear of a gentleman a few rows in front of me throughout the entire performance. I couldn't tell what it was for sure, but it appeared to be the indicator light of a Bluetooth headset. Blink. Five seconds later: Blink. Five seconds later: Blink. Repeat for two hours. What I want to know is, was this guy expecting a call during the show? If his phone rang, would he answer it from his seat? (Added: This w...

Aug 18, 2008
Post comments count 0
Post likes count 1

What happened to the Search option on the right hand side of the Start menu?

Raymond Chen

You may have noticed that in Windows Vista Service Pack 1, the Search option on the right hand side of the Start menu has been removed. What happened to it? It's redundant with the Search Box, that thing that has the keyboard focus when you initially open the Start menu. (But if you really want to open Explorer in Search mode, you can still type Windows+F or press F3 when focus is on the Start menu.) And if you want to plug into the search protocol that the Start menu uses, this MSDN page provides a sample registration and describes what sorts of queries you will be handed by the shell.

Aug 15, 2008
Post comments count 0
Post likes count 0

The Seattle Danskin Women’s Triathlon 2008

Raymond Chen

This Sunday will be the Nth annual Seattle Danskin Women's Triathlon (for some value of N greater than 1), the largest women-only triathlon. I learned about this event last year when I saw that the express lanes on the I-90 bridge were crowded with bicyclists, and I went online to try to figure out what was going on. As I clicked around, I found the Volunteer Site and was particularly impressed with the Swim Angels. (More details.) These are strong women swimmers whose job it is to accompany the weaker swimmers and provide moral support. I was chatting with a friend of mine, who noted that one of the firs...