The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Why does my setup program detect the operating system incorrectly the second time I run it?
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...
The 2014/2015 Seattle Symphony subscription season at a glance
The pocket reference guide for 2014/2015.
How can I make a callback function a member of my C++ class?
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-Keno Janssen decides to rent a bicycle to get around Las Vegas; this is what happens
A different kind of run-around.
Non-psychic debugging: Looking for leaked objects by their vtable
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, ...
The Visual Effects dialog box just tells you what you want to hear
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...
Commissioner Bud Selig was named the first recipient of the Commissioner Bud Selig Leadership Award
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.
What clock do MSG.time and GetMessageTime use?
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...
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
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...