The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Mar 19, 2012
Post comments count 0
Post likes count 0

The most exciting part of my morning is catching my bus, specifically, making the transfer

Raymond Chen

Note: Transit nerd content. You have been warned. I still rely on One Bus Away to tell me when my bus is coming. Recent changes in bus service means that there is no longer a direct bus from my neighborhood to my work. My basic options are as follows: If you sit and work out the math, the total travel time for all the options is about the same, around 29 minutes. Which is about the same time it takes me to ride my bicycle, so it basically doesn't matter which route I take, especially since traffic lights randomize the travel time by a few minutes each way. But the paradox of choice means that I still try ...

Mar 19, 2012
Post comments count 0
Post likes count 1

Why does holding the Ctrl key when selecting New Task from Task Manager open a command prompt?

Raymond Chen

Commenter Adam S wonders why holding the Ctrl key when selecting New Task from Task Manager will open a command prompt. It's a rogue feature. Windows XP introduced visual styles, and one of the tricky parts of debugging visual styles is that if the visual style engine goes berzerk, you can't see anything! One of the problems that the visual styles folks encountered when developing their feature was that sometimes they would get into a state where the Run dialog would stop working. And without a Run dialog, you couldn't install or launch a debugger to begin investigating what went wrong. The solution...

Mar 16, 2012
Post comments count 0
Post likes count 1

Memory allocation functions can give you more memory than you ask for, and you are welcome to use the freebies too, but watch out for the free lunch

Raymond Chen

Memory allocation functions like , , , and all have the property that they can return more memory than you requested. For example, if you ask for 13 bytes, you may very well get a pointer to 16 bytes. The corresponding functions return the actual size of the memory block, and you are welcome to use all the memory in the block up to the actual size (even the bytes beyond the ones you requested). But watch out for the free lunch. Consider the following code: So far so good. We allocate some memory, and then fill it with zeroes. That gives us our zero-initialized memory. Or does it? When you ask the hea...

Mar 15, 2012
Post comments count 0
Post likes count 1

Why does the VerQueryValue function give me the wrong file version number?

Raymond Chen

A customer was writing a test to verify that their patching system was working properly, but they found that even after the patch was installed, a call to reported that the file was still the original version. Why was the function reporting the wrong version? Recall that the version resource is, well, a resource. And one of the things that happens with resources is that they can get redirected based on the language the user is running. When you ask for the resources of a language-neutral DLL, the loader redirects your request to the appropriate language-specific DLL. That way, if you're running on an English ...

Mar 14, 2012
Post comments count 0
Post likes count 1

How do I get mouse messages faster than WM_MOUSEMOVE?

Raymond Chen

We saw some time ago that the rate at which you receive messages is entirely up to how fast your program calls . But what if your program is calling as fast as it can, and it's still not fast enough? You can use the function to ask the window manager, "Hey, can you tell me about the mouse messages I missed?" I can think of two cases where you might want to do this: You are a program like Paint, where the user is drawing with the mouse and you want to capture every nuance of the mouse motion. You are a program that supports something like mouse gestures, so you want the full mouse curve informatio...

Mar 13, 2012
Post comments count 0
Post likes count 1

Microspeak: Friction

Raymond Chen

In physics, friction is a force that resists motion. In Microspeak, friction is an obstacle which prevents somebody from doing something you want them to do. (The preferred verb phrase for getting over an obstacle is overcoming friction.) There is friction in the system for X that is reduced when developing with Y. Using X reduces friction of someone being able to do Y without having to Z. Many companies have found that outsourcing activities can introduce unexpected complexity, add cost and friction into the value chain, and require more senior management attention and deeper management skills than anticip...

Mar 12, 2012
Post comments count 0
Post likes count 1

If you have multiple versions of Windows installed, why do they all try to adjust the clock?

Raymond Chen

Commenter Martin notes that if you have multiple copies of Windows installed on your machine, then each one will try to adjust the clock when you enter or exit daylight saving time. "I cannot believe that this feature is a bug. Please could you comment this?" This falls into a category of issue that I like to call "So what did you expect?" (This was the catch phrase of the old Call-A.P.P.L.E. magazine.) If you have multiple operating systems installed on your machine, each one thinks that it has control of your computer. It's not like there's some standard cross-operating system mechanism for negotiating cont...

Mar 9, 2012
Post comments count 0
Post likes count 2

To some people, time zones are just a fancy way of sounding important

Raymond Chen

Standard time sounds much more standard.

Mar 8, 2012
Post comments count 0
Post likes count 1

Alt text for images are important in email, too

Raymond Chen

Apparently the IT department gave up on getting everybody to read email in plain text, and other service departments at Microsoft have moved beyond simply using HTML for markup and started adding banner images to the top of each email message. Because the best way to promote your brand to other parts of the company is to stick a banner logo at the top of every message. Here's the HTML for one such banner image, with line breaks inserted for sanity. The great thing about the absurd alt text is that that's what appears in the autopreview window and in the email notification pop-up. But wait, it gets wors...