The Old New Thing

The Grand Duke's monocle is an affectation

In the Disney adaptation of Cinderella, the Grand Duke wears a monocle. The monocle moves from eye to eye during the course of the story. The Grand Duke's monocle is an affectation. Either that, or he needs a full pair of glasses, but is very frugal...

Writing automation to wait for a window to be created (and dismiss it)

Today's Little Program uses UI Automation to cancel the Run dialog whenever it appears. Why? Well, it's not really useful in and of itself, but it at least provides an example of using UI Automation to wait for an event to occur and then respond to it. Okay, let's see what's going on here. The program registers a delegate with UI ...

When someone proposes marriage, bear in mind that there is a question that needs to be answered

A colleague of mine was at a restaurant, and he spotted a young couple at the next table. The woman fawned over a classic diamond engagement ring, and when she put it on her finger, he decided that it was safe to ask them about it. They had gotten engaged earlier that day, and the man told the story of the proposal, up to the point where he ...

Debugging: Diagnosing why malloc is failing

A customer had some code which was experiencing memory allocation failures when calling (which maps to ). The function returns , and reports . However, there was still plenty of memory free: The customer was continuing their investigation but was looking for some pointers since the bug took a day to emerge. Could it be heap fragmentation...

The heavy metal umlaut encroaches into Seattle real estate

The heavy metal umlaut is creeping into Seattle real estate. I submit for your consideration the condominium known as Bleü. I can't even tell what language they are trying to pretend to be. There are other properties in Seattle with dots, but at least the dots aren't gratuitous. Hotel Ändra in Belltown takes its name from the ...

What is this extra thread in my process?

A customer liaison asked: After applying Service Pack 2 to Windows Server 2003, my customer found that a simple MFC application (just using the template, no customization) has two threads when it is supposed to have only one. After five minutes, one of the threads exits. This doesn't happen on Windows Server 2003 RTM or Windows Server...

Excuses I learned from babies

I was visiting a friend of mine, and his young daughter was being unusually cranky. He explained, "Oh, she's teething." I filed that away as an excuse I could use the next time I felt cranky. "Sorry about that. I'm teething." Here's another excuse you might want to use: "No, I'm not drunk. I simply lost interest in remaining upright...

Execute a file as if it were a program, even though its extension is not EXE

Today's Little Program executes a file as if it were a program, even though its extension is not EXE. The idea here is to prevent somebody from running your program by accident, so you give it an extension like . This is great for preventing somebody from running the program by mistake, but how do you do it on purpose? We're merely using ...