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

Maybe if it had characters and stuff and different levels, it would be OK

In a classic series, Electronic Games Monthly plopped modern kids, ages 9 through 12, in front of classic video games: Pong, Donkey Kong, Tetris. And then recorded their reactions. Here, the kids are playing Tetris and appear to be obsessed with stuff blowing up. Tim: Which button do I press to make the blocks explode? EGM: Sorry, they don't explode. Becky: This is boring. Maybe if it had characters and stuff and different levels, it would be OK. If things blew up or something or— Sheldon: If there were bombs. Becky: Yeah, or special bricks. Like, if a yellow brick touched a red brick it would bl...

Displaying infotips for folded and unfolded listview items

When displaying infotips for listview items, you have to deal with both the folded and unfolded case. "Folded" is the term used to describe a listview item in large icon mode whose text has been truncated due to length. When the user selects the item, the full text is revealed, a process known as "unfolding". Take our scratch program and make the following changes: We create our listview, enable infotips, and add a single item with a rather long name. When you run the program, observe that the item's text is truncated at two lines if it is not selected, but it expands to full size when you selected it. W...

Jeanne Martinet teaches you how to survive a party where you don't know anybody

It's the time of year where you may find yourself attending a party where you know hardly anyone. Jeanne Martinet, author of The Art of Mingling, walks Steve Inskeep through a mock-party with tips on how to join a conversation, and (perhaps more importantly) exit one. Don't just read the article; you need to listen to the story. The mock-party is a hoot! When Susan Stamberg starts going on and on about that cranberry relish recipe...

A high waiter count on a free critical section may indicate a lock convoy

Nobody can make any progress because they keep getting stuck.

What does an invalid handle exception in LeaveCriticalSection mean?

Internally, a critical section is a bunch of counters and flags, and possibly an event. (Note that the internal structure of a critical section is subject to change at any time—in fact, it changed between Windows XP and Windows 2003. The information provided here is therefore intended for troubleshooting and debugging purposes and not for production use.) As long as there is no contention, the counters and flags are sufficient because nobody has had to wait for the critical section (and therefore nobody had to be woken up when the critical section became available). If a thread needs to be bloc...

Throwing things into a blender and seeing what happens

Manufacturer of commercial and home blenders Blendtec has produced a marketing web site Will It Blend? which features short videos of the company's CEO and new Internet blending icon Tom Dickson throwing all sorts of unusual objects into one of their blenders, to see what happens. (The videos are also on YouTube, and of course they have a blog, cleverly titled Will it Blog?) There's a miniature profile of Tom Dickson in Utah Business Magazine. When Jamba Juice told Dickson the $14,000 blender package was too expensive, he cut them a deal, asking simply for a nickel of every sale. Now, with 50 million smoot...

Do not overload the E_NOINTERFACE error

One of the more subtle ways people mess up is returning when the problem wasn't actually an unsupported interface. The return value has very specific meaning. Do not use it as your generic "gosh, something went wrong" error. (Use an appropriate error such as or .) Recall that the rules for are that (in the absence of catastrophic errors such as ) if a request for a particular interface succeeds, then it must always succeed in the future for that object. Similarly, if a request fails with , then it must always fail in the future for that object. These rules exist for a reason. In the case where COM needs ...

Okay, I changed my mind, I wrote a book after all

The Old New Thing: Practical Development Throughout the Evolution of Windows

The wisdom of seventh graders: What to do with a time machine (part 3)

(Continuing from part 2.) Here are more sentences from seventh grade time travel essays. Remember, these sentences are not representative of seventh grade writing in general; these are just the funny bits. World History The Future: Most students who travelled to the future wanted to meet themselves. Letter Format: Some students took advantage of the fact that the essay took the form of a letter. Best Conclusion