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

You can't give away something that isn't yours

This rule of real life applies to code as well. If something doesn't belong to you, then you can't give it away. For example, functions like and take ownership of the item that you pass it. In SetClipboardData's case, the memory block you pass as the parameter becomes the property of the clipboard. For it's the that becomes the property of the window manager. In both cases, you are giving control of the item to another component, but in order to do that legitimately, it must be yours to give away. This statement may be obvious, but it's surprising how many people fail to grasp its consequences. For exam...

Welcome to the International Bank of Raymond

Over a decade ago, one of my colleagues (whom I'll call "Ralph" for the purpose of this discussion) told me that he briefly ran an international bank. Well, not really. Ralph's first roommate was another Microsoft employee, somewhat of the stereotypical computer nerd in the sense that he could write code like a maniac but didn't have a good grasp on mundane life skills like, say, cashing paychecks (this was the days before direct deposit), paying bills, or opening glass doors before walking through. Ralph helped out his roommate by managing his finances for him, depositing his roommate's paychecks, paying his b...

What does TranslateAccelerator do?

For some reason, there appears to be some confusion over what does. It's very simple, and it's all spelled out in the documentation. You give it a message, and if the message is a keypress that matches an entry in the accelerator table, the corresponding or message is sent to the window you said you are translating messages for. One point of confusion is which window receives the translated message. Is it the window in the structure or the window passed as the first parameter to ? This confusion shouldn't last long, though, because of the two options, one of them raises more questions than it resolves. ...

Microspeak: On-board (verb)

Here are a few citations. On a list of activities: Presumably they mean bring on board. What makes this particularly interesting is that they didn't convert a noun to a verb; they converted a prepositional phrase to a verb, demonstrating once again the malleability of the English language. Here's a snippet from a blog post which seems to use the same meaning, but dispensing with the hyphen: Over the past 4 weeks, we have been onboarding customers slowly. On the other hand, there are usages whose intended meaning I can't quite figure out. Some titles from documents I don't have access to: How to On-Boa...

Food discovery: Vietnamese sandwiches, aka bánh mì

Some friends came down to visit from Vancouver to take advantage of the favorable exchange rate, and when the topic of lunch arose, one of them suggested Vietnamese sandwiches. "What are Vietnamese sandwiches?" I asked. "Okay, that settles it. We're having Vietnamese sandwiches for lunch," was the response. We went to the generically-named Seattle Deli and ordered our sandwiches. (I had the chicken.) For less than three dollars I was rewarded with a wonderful sandwich. Crisp French bread around a collection of vegetables, some spicy, some pickled, some fresh, but all crispy, contrasting with the softness of...

Another interesting detail from the analysis of Windows Error Reporting data for Explorer

I was in a meeting last year where I learned an interesting tidbit of information. One of the people at the meeting was looking at the error reports submitted against Explorer, and the breakdown went something like this. For the purpose of discussion, the number of reports have been normalized into "units", the precise meaning of which is left unspecified, but is meaningful for comparison purposes.† The XYZ virus (not its real name) and its variants together are responsible for the top six categories of Explorer crashes, and by an enormous margin. Seventh place, an actual bug, comes in at only 1/80th the...

König Drosselbart: Performed in clay, feathers, and other strange materials

This past weekend I went to the Seattle International Children's Festival to attended a performance of König Drosselbart in German. I was not familiar with the story beforehand, but that's okay. It just makes for a better surprise. The interpretation was very creative. The narrators embodied the characters in the story at times; other times characters were represented by props manufactured on the spot from clay, decorated with feathers and twigs. (With one exception: The princess was represented by a well-known doll.) The most amusing parts were when both techniques were used simultaneously: For exampl...

The Phantom Bug: Why doesn't MessageBox work from my WM_NCDESTROY handler?

Adrian McCarthy ran into a problem where didn't work when called from a handler. You already know how to solve this; you just have to connect the dots. See if you can do it on your own before the answer is revealed.

Bacalhau: The unofficial national dish of Portugal, and don't pass the salt

The unofficial national dish of Portugal is bacalhau, or dried salted cod. The story goes that there is a different bacalhau recipe for every day of the year. There are those who believes that the stories provide a gross underestimate. Bacalhau naturally dates back to the days before refrigeration: Drying and salting served to preserve the fish. At a group dinner, one of the faculty members lobbied heavily but ultimately unsuccessfully for us to order the bacalhau. I did have a bacalhau appetizer later in the trip, so I did hold up my end of the deal, eventually. A friend of a friend spent some time in Lisbon...