The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Jan 28, 2014
Post comments count 0
Post likes count 1

Why does my setup program detect the operating system incorrectly the second time I run it?

Raymond Chen

A customer reported that when their application called the function, it sometimes reported incorrect values. Specifically, the logs collected from clients shows that the first time the program was run on a Windows 7 machine, the operating system was correctly reported as 6.1.7600 (Windows 7), but the second time it was run, the operating system was erroneously reported as 6.0.6000 (Windows Vista). This was definitely strange behavior, and upon further questioning, the customer admitted that their application was a setup program. The fact that it was a setup program was the missing ingredient. What h...

Jan 27, 2014
Post comments count 0
Post likes count 0

The 2014/2015 Seattle Symphony subscription season at a glance

Raymond Chen

The pocket reference guide for 2014/2015.

Jan 27, 2014
Post comments count 0
Post likes count 1

How can I make a callback function a member of my C++ class?

Raymond Chen

Instead of a Little Program today, I'm going to answer a Little Question. This is a common beginner question, but I figure I'll just spell it out right here for posterity. First of all, you probably noticed that you can't do this: That's because the is declared as a so-called free function, but member functions are not free. Neither are function objects (also known as functors) so you can't use a as a window procedure either. The reason is that member functions and functors need to have a hidden parameter, but free functions do not have a hidden parameter. On the other hand, static methods are free fu...

Jan 24, 2014
Post comments count 0
Post likes count 1

Jan-Keno Janssen decides to rent a bicycle to get around Las Vegas; this is what happens

Raymond Chen

A different kind of run-around.

Jan 24, 2014
Post comments count 0
Post likes count 1

Non-psychic debugging: Looking for leaked objects by their vtable

Raymond Chen

A programmer on the GHI team reported that they were hitting an assertion failure using an internal library and asked for help debugging it. I didn't work on this internal library, but on the other hand I'm also not afraid to look inside and around. The assertion failure said, "Assertion failed: All widgets from a factory must be destroyed before you can unregister the factory." The factory does not keep a list of all the widgets it created. It merely keeps a count and asserts that the count is zero when the factory is unregistered." A good start would be to find the widgets that are still outstanding, ...

Jan 23, 2014
Post comments count 0
Post likes count 1

The Visual Effects dialog box just tells you what you want to hear

Raymond Chen

The Visual Effects dialog box has three options, "Let Windows choose what's best for my computer," "Adjust for best appearance," and "Adjust for crappiest appearance best performance." Some people have discovered the registry key where the Visual Effects dialog box remembers which radio button was most recently checked, but they found that when they programmatically manipulate the registry key, there is no effect on the actual visual settings. What's going on? What's going on is that the registry key is just there to tell you what you want to hear. It remembers which radio button you clicked, so that when you r...

Jan 22, 2014
Post comments count 0
Post likes count 0

Commissioner Bud Selig was named the first recipient of the Commissioner Bud Selig Leadership Award

Raymond Chen

In what was sure to have been a stunning surprise, last night, the first annual Commissioner Bud Selig Leadership Award was given out. And the winner was... Allan H. "Bud" Selig! I wonder who will win next year. Or who will win the Bud Selig Lifetime Achievement Award. Perhaps just to save time, they will name Bud Selig the Bud Selig Leadership Award Recipient For Life.

Jan 22, 2014
Post comments count 0
Post likes count 1

What clock do MSG.time and GetMessageTime use?

Raymond Chen

The structure has a field called which is a . There is also a function which returns a . Both are documented as returning the time the message was generated, but the types are different. Are these time units comparable? Yes, they are the same thing. They all use the 32-bit timer provided by the function. Sorry about the inconsistency in signed/unsigned-ness. Feel free to cast between them; they are fundamentally the same thing. Whether you prefer the signed or unsigned version depends on what you intend to do with the calculation, specifically, how you want to treat the case where the events occurred out...

Jan 21, 2014
Post comments count 0
Post likes count 1

When the Web page says that a tool is not supported, it means that if you find a problem and contact technical support, they're just going to point you back to the Web page

Raymond Chen

I file this under the category of People refuse to read what is right in front of them. There used to be a number of utilities available for download which all go by the name PowerToys. And they all contain text like this: Note: We take great care to ensure that PowerToys work as they should, but they are not part of XYZ and are not supported by Microsoft. For this reason, Microsoft Technical Support is unable to answer questions about PowerToys. This sentence isn't exactly in the fine print either. It's right there at the top of the page. This nevertheless does not stop a customer from contacting their su...