The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Dec 21, 2006
Post comments count 0
Post likes count 0

The unanswered Explainer questions

Raymond Chen

Slate's Explainer column answers questions about current events. Sometimes they do it multiple times, as they did when I asked them how to pronounce the name Pinochet and they said Pee-no-CHAY, then later corrected themselves with pin-oh-CHET, and then again re-corrected themselves with Yes. Yesterday, the Explainer provided a selection of the questions they received and didn't answer and invited the readers to vote on which one they would like to see answered. My favorite question was the one that begins "I have a sister that stresses the hell out of me," and goes on and on about the car accident, how her ...

Dec 21, 2006
Post comments count 0
Post likes count 0

The evolution of version resources – 32-bit version resources

Raymond Chen

Last time we looked at the format of 16-bit version resources. The 32-bit version is nearly identical, except that everything is now in Unicode. Each node is stored in the following structure (in pseudo-C): In words, each version node begins with a 16-bit value describing the size of the nodes in bytes (including its children), followed by a 16-bit value that specifies how much data (either binary or text) are associated with the node. The is zero if the node data is binary or one if the node data is a string. Other values of are reserved for future use. The rest is the same as before: A null-terminated key...

Dec 20, 2006
Post comments count 0
Post likes count 0

The evolution of version resources – 16-bit version resources

Raymond Chen

I return to the extremely sporadic series on resources with a description of the version resource. You don't need to know how version resources are formatted internally; you should just use the version resource manipulation functions , , and their friends. I'm providing this information merely for its historical significance. Version resources can be viewed as a serialized tree structure. Each node of the tree has a name and associated data (either binary or text), and each node can have zero or more child nodes. The root node is always named and is a binary node consisting of a structure. Beyond that, you c...

Dec 19, 2006
Post comments count 0
Post likes count 0

Pacific Northwest storm recovery continues

Raymond Chen

Puget Sound Energy has a service status page where they update how things are going in the power restoration process. The repair crews (some from as far away as Kansas) are working 40-hour shifts with eight hours' rest between shifts. (That article is from a snowstorm a few weeks ago. A manager is quoted as saying. "I've been in this industry 30 years, and I haven't seen anything like this." Well, now he gets to see it twice in one year, and it's not even winter yet!) Electricity was restored to my house after only 36 hours. All of a sudden I was popular! (If you can't be popular for who you are, at least be p...

Dec 19, 2006
Post comments count 0
Post likes count 2

I bet somebody is looking to get a really nice bonus for that feature: Attention

Raymond Chen

"I bet somebody is looking to get a really nice bonus for that feature." A customer was having trouble with one of their features that scans for resources that their program can use, and, well, the details aren't important. What's important is that their feature ran in the Startup group, and as soon as it found a suitable resource, it displayed a balloon tip: "Resource XYZ has been found. Click here to add it to your resource portfolio." We interrupted them right there. — Why are you doing this? "Oh, it's a great feature. That way, when users run our program, they don't have to go looking for the resour...

Dec 18, 2006
Post comments count 0
Post likes count 1

Some call it context, others call it reference data, but whatever it is, it's yours

Raymond Chen

Different functions call it different things. calls it . calls it reference data. calls it . just calls it a parameter! But whatever its name is, it means the same thing: It's a value the function doesn't care about. All the function does is hand that value back to you. What the value means is up to you. What if you need to pass more context than a single pointer? What if you want to pass, say, two pointers? Then put the two pointers in a structure and pass a pointer to that structure. When you do this, you introduce lifetime issues, so make sure you have a plan for deciding who is responsible for freeing t...

Dec 18, 2006
Post comments count 0
Post likes count 1

Do not write in-process shell extensions in managed code

Raymond Chen

Jesse Kaplan, one of the CLR program managers, explains why you shouldn't write in-process shell extensions in managed code. The short version is that doing so introduces a CLR version dependency which may conflict with the CLR version expected by the host process. Remember that shell extensions are injected into all processes that use the shell namespace, either explicitly by calling or implicitly by calling a function like , , or even . Since only one version of the CLR can be loaded per process, it becomes a race to see who gets to load the CLR first and establish the version that the process runs, and ever...

Dec 16, 2006
Post comments count 0
Post likes count 1

Why do user interface actions tend to occur on the release, not on the press?

Raymond Chen

It has its ups and downs.

Dec 14, 2006
Post comments count 0
Post likes count 1

Computing listview infotips in the background

Raymond Chen

When the listview control asks you for an infotip, it sends you then notification, and when you return, the result is displayed as the infotip. But what if computing the infotip takes a long time? You don't want to stall the UI thread on a long operation, after all. This is where comes in. If you want to say, "Um, I'm not ready with that infotip yet," you do two things: First, you return a blank infotip to the listview in response to ; this tells the listview not to display anything. Then, when you have the infotip, you send the message to say, "Oh, here's that infotip you asked for. If you were still wonde...