The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

The x86 architecture is the weirdo: Structured exception handling

If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it's the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured exception handling, "It would be interesting to know why this 'invention' was introduced in 64-bit Windows when no other version of Windows requires it." (The original text was "when no other OS requires it", but I'm assuming that this was in the context of Windows-based OS, since unix doesn't have struc...

Raymond’s highly scientific predictions for the 2013 NCAA men’s basketball tournament

Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket. This year, I look at the number of fans of the basketball team's official Facebook page, or one tenth of the number of fans of the school's athletic department, whichever is greater. The fraction 1/10 is completely arbitrary, but that's what makes this algorithm highly scientific. Notes on this year's algorithm: Once the field has been narrowed to four teams, the results are determined by a coin flip. (I should have done this when the field reduced to eight teams rather than four, b...

Microspeak: Science project

A science project is a feature that is really cool and challenging from a technological standpoint but is way overkill for the end-user scenario at hand. Back in the late 1990's, a bunch of us cooked up this idea for a networked screen saver that ran at night after most people had gone home from work. You told it the physical location and compass orientation of everybody's monitor. The networked screen saver created a virtual red bouncing ball that traveled around the building in three dimensions. The screen saver showed a viewport into the three-dimensional virtual world that contained the bouncing ball. Th...

It may be your birthday, but why stop at just the day? Think big!

I had the pleasure of meeting a friend of a friend who is an odd, quirky sort, in a wholly endearing sort of way. When her birthday comes around, she isn't satisfied to have just one day of celebration. Or even a week. No, she takes the entire month. The entire month of March is open season for taking her to dinner, getting her a gift, or otherwise celebrating what an awesome person she is. Every year I receive an automated reminder, "X's birthday: all day." And I say to myself, "What, just the day?" Bonus chatter: Her father is from Turkey, and her mother is Swiss (so she's a deli sandwich, half turkey, hal...

Manipulating the positions of desktop icons

Just putting together the pieces you already have.

Playing with the Windows Animation Manager: Moving lots of stuff around

We saw last time a sample program that moved a circle around. Today I'll try to build the classic demo of animating a lot of objects in a list. This isn't the prettiest code, but I wanted to make as few changes as possible. Start with the Timer-Driven Animation, and make these changes to the MainWindow.h header file. struct Item { IUIAnimationVariable *m_pAnimationVariableX; IUIAnimationVariable *m_pAnimationVariableY; Gdiplus::Color m_color; }; class MainWindow { ... // HRESULT ChangeColor( // DOUBLE red, // DOUBLE green, // DOUBLE blue // ); ...

Playing with the Windows Animation Manager: Fixing a sample

Windows 7 provides a component known as the Windows Animation Manager, known to some people by its acronym WAM, pronounced "wham". There are some nice sample programs for WAM on MSDN, but for some reason, the authors of the samples decided to animate the three color components of a resultant color. Because apparently the authors of those sample programs can look at a color and say, "Oh, clearly the red component of this color increases gradually at first, then speeds up its rate of increase, and then slows back down until it reaches its final value; while simultaneously the blue component is doing the o...

Closing holes in the update notification pattern

Suppose you have a function that is registered to be called the next time something gets updated, and suppose that the notification is a one-shot notification and needs to be re-armed each time you want to wait for the next notification. (For example, the RegNotifyChangeKeyValue function behaves this way.) Consider the following code fragment: void onUpdateThing() { // get the updated properties of the thing getThingProperties(); // ask to be called back the next time it updates registerUpdateCallback(onUpdateThing); } mainProgram() { // get the thing's initial properties // and re...

How do I hide Public Libraries on all computers in my organization?

A customer wanted to know how to hide the libraries named Public (Documents), Public Pictures, and Public Videos on all computers in their organization. It turns out that this is already documented in TechNet under the topic Administrative How-to Guides (I found this page by issuing a Web search for 〈library-ms〉.) The customer is specifically interested in the section titled How to Customize and Deploy Libraries. I'll let you read that Web page for the details. I'm just posting this here so that the next customer won't burn an expensive support call on something that's already documented on Tec...