The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Oct 23, 2009
Post comments count 0
Post likes count 1

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

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...

Oct 22, 2009
Post comments count 0
Post likes count 1

Once you announce a date, you’re already late

Raymond Chen

Time overrides the message.

Oct 21, 2009
Post comments count 0
Post likes count 1

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

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...

Oct 20, 2009
Post comments count 0
Post likes count 1

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

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?

Oct 19, 2009
Post comments count 0
Post likes count 0

Leaving Reflections | Projections 2009, travel marathon part two

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...

Oct 19, 2009
Post comments count 0
Post likes count 1

Thinking inside the box

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 ...

Oct 16, 2009
Post comments count 0
Post likes count 0

Arrived in Urbana-Champaign for Reflections|Projections 2009

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 ...

Oct 16, 2009
Post comments count 0
Post likes count 1

Important window message numbers to memorize

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...

Oct 15, 2009
Post comments count 0
Post likes count 1

Don't use global state to manage a local problem, practical exam

Raymond Chen

There was much speculation as to how the "Ignore other applications that use Dynamic Data Exchange" setting got set. Well, one possibility is that somebody used global state to manage a local problem. "Why on earth does this setting exist?" I don't know, but there appear to be scripts which rely on it. The setting is exposed to scripts, and perhaps at some point you ran a script which didn't want Excel to be interrupted while it was running. The documentation for the Excel Application Object does say that it contains application-wide (global) settings. I'm not saying that's why you are encountering the pr...