The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Feb 23, 2007
Post comments count 0
Post likes count 0

The 2007/2008 Seattle Symphony subscription season at a glance

Raymond Chen

Every year, I put together a little pocket guide to the Seattle Symphony subscription season for my symphony friends to help them decide which ticket package they want. As before, you might find it helpful, you might not, but here it is anyway. Notes: This chart doesn't include "one-off" concert series such as the Visiting Orchestras or Distinguished Artists series. Explanations for the partial blocks: The 18A series gets the 11/8 program; 18B gets 11/10. The Musically Speaking concerts typically omit one of the pieces from the evening program, substituting on-stage commentary. The comments column very cru...

Feb 23, 2007
Post comments count 0
Post likes count 1

Final remarks on LockWindowUpdate

Raymond Chen

It's not all that useful any more.

Feb 22, 2007
Post comments count 0
Post likes count 1

How to get your laptop to resume from standby in under two seconds

Raymond Chen

One of my colleagues recently posted the story of the work he did to get laptops to resume quickly. The fun part was implementing the optimizations in the kernel. The not-fun part was finding all the drivers who did bad things and harassing their owners into fixing the bugs. One some laptops, he could get the resume time down to an impressive one second. And then entropy set in. It's likely you've never seen a real off-the-shelf laptop resume this quickly. And the reason is that as soon as you stop twisting the arms of all the driver writers, they stop worrying about how fast your laptop resumes and go back t...

Feb 22, 2007
Post comments count 0
Post likes count 1

With what operations is LockWindowUpdate not meant to be used?

Raymond Chen

Okay, now that we know what operations is meant to be used with, we can look at various ways people misuse the function for things unrelated to dragging. People see the "the window you lock won't be able to redraw itself" behavior of and use it as a sort of lazy version of the message. Though sending the message really isn't that much harder than calling . It's twenty more characters of typing, half that if you use the macro in . As we noted earlier, only one window in the system can be locked for update at a time. If your intention for calling is merely to prevent a window from redrawing, say, becaus...

Feb 21, 2007
Post comments count 0
Post likes count 0

Mandarin Chinese gaining popularity in public schools

Raymond Chen

NPR reports that Mandarin Chinese is gaining popularity in public schools. (But please oh please don't take pronunciations lessons from the student at time code 3:25. His first tone was clearly a second—falling victim to the classic mistake of applying English tone shaping to Chinese syllables.) On the other hand, some of those students who chose to study Mandarin Chinese didn't, um, do their homework: Some say they are here by accident or because they thought it would be an easy "A". Oops. I do admire the argument of one parent against learning Chinese: Everybody is going to speak English. I'm sure t...

Feb 21, 2007
Post comments count 0
Post likes count 1

With what operations is LockWindowUpdate meant to be used?

Raymond Chen

As I noted earlier, the intended purpose of can be captured in one word: dragging. The simplest case of is used by the window manager when you move or resize a window and "Show window contents while dragging" is disabled. When you start the move/size operation, the window manager locks the entire desktop so it can draw the dotted-rectangle feedback without risking interference from another window that happens to intersect the dotted-rectangle. When the move/size operation is complete, the desktop is unlocked, and the world returns to normal. A common case where an application uses is if it wants to draw a c...

Feb 20, 2007
Post comments count 0
Post likes count 0

Crush Finder experiment gets off the ground at Princeton

Raymond Chen

And who says these college students aren't getting anything done? The Princeton University student government announced, among other things, a web site wherein students could list up to five other people they have crushes on, and if two people list each other, the web site puts the two potential lovebirds in touch with each other. The site went online on (appropriately enough) Valentine's Day, and student reaction was swift, with over a thousand students signing up before the day was over. You can pay Crush Finder a visit, though since you're (probably) not a student you can't actually submit anything, but th...

Feb 20, 2007
Post comments count 0
Post likes count 1

How is LockWindowUpdate meant to be used?

Raymond Chen

Now that we know how works, we can look at what it is for. Actually, the intended purpose of can be captured in one word: dragging. But we'll get to that a little later. The purpose of is to allow a program to temporarily take over the responsibility of drawing a window. Of course, in order to do this, you have to prevent the window procedure (or anybody else) from doing their normal drawing activities; otherwise, the two pieces of code (the code that normally draws the window and the code that's trying to take over) fight for control of the window and you get an ugly mess since neither knows what the other...

Feb 19, 2007
Post comments count 0
Post likes count 1

What does LockWindowUpdate do?

Raymond Chen

Poor misunderstood . This is the first in a series on , what it does, what it's for and (perhaps most important) what it's not for. What does is pretty simple. When a window is locked, all attempt to draw into it or its children fail. Instead of drawing, the window manager remembers which parts of the window the application tried to draw into, and when the window is unlocked, those areas are invalidated so that the application gets another message, thereby bringing the screen contents back in sync with what the application believed to be on the screen. This "keep track of what the application tried to dr...