The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Yes, there's a new desktop window manager, but no, I don't know any more about it than you do
Oct 26, 2009
Post comments count 0
Post likes count 0

Yes, there's a new desktop window manager, but no, I don't know any more about it than you do

Raymond Chen
Raymond Chen

Sean W. requests, via the suggestion box, "an in-depth discussion of the use of the shell's new Desktop Window Manager (Dwm*) functions in Win32." The desktop window manager is not actually part of the shell. It operates at the window manager level. (Notice that DWM is active even when Explorer isn't running.) You probably should have posted your suggestion to Greg Schechter's request for DWM topics which was not too old at the time you posted your topic suggestion. But then again, "Best practices for applications under the DWM" was on his list of future topics, so it looks like what you wanted was already on ...

If you have to cast, you can't afford it
Oct 23, 2009
Post comments count 0
Post likes count 0

If you have to cast, you can't afford it

Raymond Chen
Raymond Chen

A customer reported a crash inside a function we'll call : The title of today's entry gives the answer away. (The title is also an exaggeration, but it's a pun on the saying If you have to ask, you can't afford it.) The last parameter to the function is declared as a : A pointer to a generic pointer. Note that it is not itself a generic pointer, however. A generic pointer can point to anything, possibly unaligned. But this is an aligned pointer to a generic pointer. Therefore, the memory for the generic pointer must be aligned in a manner appropriate to its type. But this caller didn't pass a pointer to...

Once you announce a date, you’re already late
Oct 22, 2009
Post comments count 0
Post likes count 0

Once you announce a date, you’re already late

Raymond Chen
Raymond Chen

Time overrides the message.

Please, sir take a seat, sit anywhere you like, but oh, no, not there, rats
Oct 21, 2009
Post comments count 0
Post likes count 0

Please, sir take a seat, sit anywhere you like, but oh, no, not there, rats

Raymond Chen
Raymond Chen

Here's a joke: Question: Where does Bill Gates sit? Answer: Anywhere he wants. (Naturally, substitute the chairman of your company for Bill Gates.) I was told this story by a manager who was preparing a demo for Bill Gates. Bill was going to pay a visit to the offices of one particular project which was still under development and be taken on a tour, stopping by offices to see how things are going and get demos of different parts of the project. This manager was in charge of one of the features and naturally was called upon to prepare a little demo. Chance favors the prepared, and our manager took great care...

How to write like Raymond: Start a sentence with a question mark
Oct 20, 2009
Post comments count 0
Post likes count 0

How to write like Raymond: Start a sentence with a question mark

Raymond Chen
Raymond Chen

Another installment in the extremely sporadic series on how to write like Raymond. I use the question mark as an emoticon to indicate befuddlement or confusion. (This is not to be confused with the use of an inverted question mark in Spanish.) Here's an imaginary example: To: Cakes and Cookies Discussion Hi, I'm trying to bake a carrot cake, but I'm having trouble finding the right staple gun. Does anybody have any recommendations? My reply might go something like this: ? What the heck are you planning to do with that staple gun?

Leaving Reflections | Projections 2009, travel marathon part two
Oct 19, 2009
Post comments count 0
Post likes count 0

Leaving Reflections | Projections 2009, travel marathon part two

Raymond Chen
Raymond Chen

Thanks, everybody, for coming out to the Job Fair and attending my talk at Reflections | Projections 2009. Though I should have predicted that scheduling a talk on Saturday morning means that attendance will be somewhat sparse. Thanks to the conference staff with special shout-outs to Kim Vlcek, Bhargav Nookala, Jim Wordelman, and Matt Dordal for taking care of me during the conference. Returning to Seattle was also a minor adventure. On my way out out of town, I stopped by Papa Del's, generally considered the benchmark for Chicago-style pizza, but they don't sell single slices for take-out, and I didn't feel...

Thinking inside the box
Oct 19, 2009
Post comments count 0
Post likes count 0

Thinking inside the box

Raymond Chen
Raymond Chen

Commenter Nick asks whether any though has been given to running applications in a sandbox where they are given access only to their installation directory, My Documents, and a handful of other directories and registry keys. "I feel that this would seriously prevent viruses/spyware from being as effective, and apps would not be able to dump files all over the users' HD." Yes, a lot of thought has been given to sandboxing (most of which I am not at liberty to discuss) but the compatibility consequences have been a constant source of trepidation. For example, if you restrict the application just to My Documents ...

Arrived in Urbana-Champaign for Reflections|Projections 2009
Oct 16, 2009
Post comments count 0
Post likes count 0

Arrived in Urbana-Champaign for Reflections|Projections 2009

Raymond Chen
Raymond Chen

Today was a long travel day. I left my office at 9:30am to catch the bus from Redmond to downtown Seattle, then took the train to the Tukwila station, then took the shuttle bus to Seattle-Tacoma International Airport (because Airport Station doesn't open until later this year), then flew to Chicago O'Hare airport, and then drove to Urbana-Champaign, with a stop at the Bourbonnais Steak and Shake on the recommendation of a friend as a good stopping point—about halfway—and an introduction to classic Midwest road food, arriving (after several wrong turns) at my hotel at midnight. If only there were a ...

Important window message numbers to memorize
Oct 16, 2009
Post comments count 0
Post likes count 0

Important window message numbers to memorize

Raymond Chen
Raymond Chen

You probably know them already, but if you're new to Win32, here are some key window messages. I would normally suggest that you commit them to memory, but if you do enough debugging, you'll end up memorizing them anyway because you see them all the time. I include in the list even though it is a low-traffic message because you do see it a lot when you are investigating hangs. The (which also goes by the name ) is a common culprit when investigating why your program has wedged: You're broadcasting a notification and there's a window in the system that isn't responding. I know that Visual Studio has a shortc...