The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Mar 18, 2013
Post comments count 0
Post likes count 1

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

Raymond Chen

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...

Mar 18, 2013
Post comments count 0
Post likes count 2

Manipulating the positions of desktop icons

Raymond Chen

Just putting together the pieces you already have.

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

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

Raymond Chen

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 Main­Window.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 // ); ...

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

Playing with the Windows Animation Manager: Fixing a sample

Raymond Chen

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...

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

Closing holes in the update notification pattern

Raymond Chen

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 Reg­Notify­Change­Key­Value 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...

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

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

Raymond Chen

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...

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

Redistributing computers among offices for heating purposes

Raymond Chen

Some time ago, I joked about the people who rearrange computers in their house during the winter in order to use them as space heaters. Turns out this happens a lot at Microsoft. One of my friends said that one of his coworkers used a small heater in her office to keep warm. On the other hand, his office always ran warm because of all the computers in it. They hit upon a simple solution to both problems: "Now she's using a 12 core/24 thread space heater that's a lot quieter than her old one." At one point in time, I had a large number of computers in my office, including an Itanium prototype. (You knew it w...

Mar 11, 2013
Post comments count 0
Post likes count 1

Derive the age of the planet Jupiter from the properties of liquid hydrogen and the planet’s surface temperature

Raymond Chen

I dreamed that my homework assignment was to derive the age of the planet Jupiter. The professor hinted that physical properties of liquid hydrogen and the current Jupiter surface temperature would be useful. My classmate Ted, on the other hand, had to extend a C++ base class to record a GUID name. The two of us were taking a class together where we watched a reality show about two ditzy celebrities, and the professor said, "The next episode is so stupid, I don't even want anybody to watch it. But they do learn about Sirens of Greek mythology, so can you guys write up a quick one-pager to get everybody up t...

Mar 11, 2013
Post comments count 0
Post likes count 1

How can I see what files and shares are being accessed remotely, and the general usage pattern for the NetXxx functions

Raymond Chen

Today's Little Program is a command line version of the Shared Folders MMC snap-in. Why? Because it illustrates the usage pattern for the Net­Xxx family of functions. (It's also a clone of the networking portion of the openfiles tool.) The Net­Xxx family of functions generally work like this: You pass in some parameters that describe what you want. Server name, that sort of thing. You pass a "level" parameter that describes what information you want. The function allocates memory to hold the results you requested, and it returns a pointer to that memory through a bufptr para...