The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

May 14, 2015
Post comments count 0
Post likes count 1

Low-level hooks have thread affinity, so make sure you keep an eye on the thread

Raymond Chen

Poof, it's gone.

May 13, 2015
Post comments count 0
Post likes count 1

Why don't you forward WM_GETMINMAXINFO and clamp the results?

Raymond Chen

In my illustration of how to make a window resizable in only one direction, commenter Josua asks, "Why don't you forward and clamp the results?" I'm going to assume the question is really "Why don't you forward before clamping the results?" rather than "Why did you bother writing all this code in the first place? Why not simply forward and clamp the results?"¹ The answer is that forwarding doesn't do anything. As noted in the documentation, the incoming structure already has the default values on entry. The default handler for the message returns without doing anything, since all the default handler...

May 12, 2015
Post comments count 0
Post likes count 1

How does Task Manager compute Up Time, and why doesn't it agree with GetTickCount?

Raymond Chen

Task Manager shows a piece of information called "Up time". How is this value calculated, and why doesn't it agree with the value reported by /? Task Manager calculates "up time" by subtracting the system boot time from the current time. In other words, it is misnamed; it really should be called time since system was started. It doesn't subtract out the time when the computer was in sleep or hibernation. The tick count, on the other hand, counts only time that elapses while the computer is on.

May 11, 2015
Post comments count 0
Post likes count 1

Can I run a service executable from a network location?

Raymond Chen

You can, but you shouldn't.

May 8, 2015
Post comments count 0
Post likes count 1

Documentation creates contract, which is why you need to be very careful what you document

Raymond Chen

Once it's documented, it needs to remain supported forever.

May 7, 2015
Post comments count 0
Post likes count 1

Hidden message in a T-shirt, it's been done before

Raymond Chen

While everybody is trying to figure out the hidden message in Joe Belfiore's T-shirt,¹ I figure I'd give you an easier puzzle. Here is the pattern of 0's and 1's printed on the T-shirt handed given out at the Windows 8 kick-off meeting. Because you don't have a project until you have a T-shirt. The actual shirt clipped many of the digits to make the shape come out smoother. I've filled in the partial digits. There are at least two typos in the shirt. It didn't take a room full of developers long to decode the message. Click here to reveal the answer. The digits are merely the binary encoding ...

May 6, 2015
Post comments count 0
Post likes count 2

Why is there an invisible U+202A at the start of my file name?

Raymond Chen

The desperation Left-to-right marker.

May 5, 2015
Post comments count 0
Post likes count 1

What does it mean when the Advanced Security Settings dialog says that an ACE was inherited from "Parent Object" without naming the specific parent?

Raymond Chen

The Advanced Security Settings dialog shows the ACEs in an object's ACL, and one of the pieces of information is a column labeled Inherited from which identifies whether the ACE was inherited, and if so, from where. A customer observed that when they opened the Advanced Security Settings dialog, one of their objects had an ACE that showed Parent Object as the Inherited from. However, when they went to the parent object , that ACE is nowhere to be found. How can an ACE be inherited from its parent, when it doesn't exist in the parent? The Advanced Security Settings dialog is trying to be helpful, but in...

May 4, 2015
Post comments count 0
Post likes count 1

Creating a window that can be resized in only one direction

Raymond Chen

Overriding WM_NCHITTEST.