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

How does PostQuitMessage know which thread to post the quit message to?

Commenter bav016 asks how functions like and know which thread the messages should go to. Unlike some functions such as which have a window handle parameter that lets you say which window you want to operate on, and don't say which thread the or message should go to. How do they decide? The messages go to the current thread; that is, they are delivered to the thread that called the function in the first place. There are many functions which operate on an implicit message queue, and those cases, they operate on the message queue associated with the thread making the call. If you call you retrieve the...

It’s surprising how suddenly those new skins started pouring in

A friend of mine told me a story of a project from over ten years ago. Part of the product design was that it would include a bunch of skins (visual styles). The development team had written up the skinning infrastructure, but the company which was hired to create the actual skins hadn't delivered anything. My friend's assignment was to test the skin-switching interface, but since there were no skins, there was nothing to test. My friend was responsible for testing a bunch of other product features, so it's not like the days were spent thumb-twiddling. But eventually, it got to the point where the automated tes...

The programmers don’t design skins; they just make skins possible

Not all skill sets are interchangeable. That's why we have concepts like division of labor and specialization. But it appears that not everybody understands this. I was reminded of this topic when I read the reactions to the Microsoft Exchange Team announcing that they had added Xbox and Zune themes to OWA. Many people were shocked, such as Loren, who was furious that "development time" was wasted on something frivolous like new themes when there are so many bugs that need to be fixed. Loren appears to believe that the people who do graphic design and the people who are up to their elbows in the code base fi...

Raymond misreads flyers: A Taste of WWL

There were flyers in our building inviting people to attend a food event called A Taste of WWL. The letters WWL stand for Windows and Windows Live, but the font they chose for the sign was confusing to me. The capital L looked like a capital I, and I misread the poster as an invitation to attend A Taste of WWI. And then I thought, "Who the heck thought World War I was a fun event we'd want to re-experience?" One of my colleagues, who also misread the poster, had a much more succinct response: "Mmmm... mustard gas..."

When debugging a stack overflow, you want to focus on the repeating recursive part

When your program breaks into the debugger with a stack overflow, you will get a ridiculously huge stack trace because your program has gone into some sort of recursive death. (This is not a statement of metaphysical certitude, but it is true with very high probability.) But the place where the program crashed is usually not interesting at all. Here's a sample stack trace. (Warning: Ridiculously long stack traces ahead because stack traces from stack overflows are always ridiculously long. Apologies to my blind readership.) ntdll!RtlpAllocateHeap+0x394f2 ntdll!RtlAllocateHeap+0x151 ntdll!RtlFormatCurrentUserKe...

Microspeak: Learnings

If things you teach are teachings, then things you learn must be learnings, right? Good Microspeak citations for this word are hard to find since the word is rarely used in a sentence; it's just a heading in a slide presentation. I found dozens of presentations that had a slide titled Learnings from XYZ, or, for those who want to sound really fancy, Key Learnings from XYZ, but very few actual sentences. Here are two: Alice will send an email to Bob with regards to any learnings from the XYZ program being incented to do ABC. What are our key learnings for this project? There's that word key again, along wi...

Not my finest hour: Misreading a product label

I had finished some store-bought soup and thought to myself, "That was a pretty good soup. What brand was it? I'll buy it again." I went to my recycle bin to fish out the aseptic box that the soup came in, and looked for the brand name. And I found it: dnos. I thought to myself, "That's a strange name for a soup company."

Even if you have code to handle a message, you’re allowed to call DefWindowProc, because you were doing that anyway after all

Just because you write case WM_SOMETHING: doesn't mean that you have to handle all possible parameters for the WM_SOMETHING message. You're still allowed to call the DefWindowProc function. After all, that's what you did when you didn't have a case WM_SOMETHING: statement in the first place. switch (uMsg) { case WM_CHAR: OnChar(...); return 0; default: return DefWindowProc(...); } The above code fragment doesn't handle the WM_SOMETHING message at all. Suppose the WM_SOMETHING message uses the wParam parameter to specify what type of something occurred, and you only want to override the default p...

Kids love cake, but that doesn’t make them good judges of cake

My friend who got married last year went to the Seattle Wedding Show (here are some pictures from the 2007 show courtesy of a vendor's blog) and, through a series of circumstances not relevant to the story, combined the visit with a brief stint of babysitting for her nieces, one a tomboy and the other a girly-girl. The children's father came to pick them up after a half hour, but that half hour at the wedding show was quite exciting for two little girls. It was hardly surprising that the "I want to be a princess when I grow up" girly-girl would be completely enthralled by the wedding show. What was unexpected w...