Raymond Chen

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

Post by this author

Double-clicking radio buttons

A subtlety that adds a level of polish to your dialogs is supporting double-clicked radio buttons as an abbreviation for "select + OK". (Or "select + Next" or "select + Finish" if the page is part of a wizard.) Consider the following dialog template and associated dialog procedure: 1 DIALOGEX DISCARDABLE 32, 32, 200, 76 STYLE ...

Watch out, there are Swedes in the hallway!

Whenever I go to IKEA Seattle, I try to speak Swedish with the people who work there, but it never works. Yesterday, I was heading to a colleague's office to drop off Symphony tickets. (A group of friends wanted tickets together, so the order was placed in my name, and I needed to distribute them to the people in the group.) As I neared ...

Drawing a monochrome bitmap with transparency

Last time, I left you with a brief puzzle. Here are two approaches. I am not a GDI expert, so there may be even better solutions out there. To emphasize the transparency, I'll change the window background color to the application workspace color. BOOL WinRegisterClass(WNDCLASS *pwc) { pwc->hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE...

Rendering menu glyphs is slightly trickier

Last time, we saw how to draw themed and unthemed radio buttons, and I mentioned that menu glyphs are trickier. They're trickier because they are provided as raw monochrome bitmaps instead of fully-formed color-coordinated bitmaps. First, let's do it wrong in order to see what we get. Then we'll try to fix it. Start with a clean new scratch...

Microsoft Company Picnic 2005

This weekend, it was Microsoft's turn to rent Mountain Meadows Farm for the company picnic. As I noted last year, the picnic is put on by a company that just puts on company picnics all summer. In addition to Microsoft, they also do Alaska Air, Honeywell, T-Mobile, and Amazon. I decided to bicycle to the picnic this year. The route was ...

Rendering standard Windows elements

The DrawFrameControl function allows you to render standard Windows elements in your custom controls. Let's start by simply rendering a selected radio button. Start with our new scratch program and make this very simple change: class RootWindow : public Window { ... protected: void PaintContent(PAINTSTRUCT *pps); ... }; void ...

Does Windows have a limit of 2000 threads per process?

Often I see people asking why they can't create more than around 2000 threads in a process. The reason is not that there is any particular limit inherent in Windows. Rather, the programmer failed to take into account the amount of address space each thread uses. A thread consists of some memory in kernel mode (kernel stacks and object ...

What is this “web site” thing you are talking about?

One reaction I've seen when people learn about all the compatibility work done in the Windows 95 kernel is to say, Why not add code to the installer wizard [alas, page is now 404] which checks to see if you're installing SimCity and, if so, informs you of a known design flaw, then asks you to visit Electronic Arts' webpage for a patch...

When the normal window destruction messages are thrown for a loop

Last time, I alluded to weirdness that can result in the normal cycle of destruction messages being thrown out of kilter. Commenter Adrian noted that the WM_GETMINMAXINFO message arrives before WM_NCCREATE for top-level windows. This is indeed unfortunate but (mistake or not) it's been that way for over a decade and changing it now would ...

What is the difference between WM_DESTROY and WM_NCDESTROY?

There are two window messages closely-associated with window destruction, the WM_DESTROY message and the WM_NCDESTROY message. What's the difference? The difference is that the WM_DESTROY message is sent at the start of the window destruction sequence, whereas the WM_NCDESTROY message is sent at the end. This is an important distinction ...