The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

The sign that a trend is over: It shows up in a movie
Jul 29, 2008
Post comments count 0
Post likes count 0

The sign that a trend is over: It shows up in a movie

Raymond Chen
Raymond Chen

George Mannes talks with Mike Pesca on his observation that once a financial trend shows up in a movie or television show, it's over.

Be careful what you name your mailing list
Jul 29, 2008
Post comments count 0
Post likes count 0

Be careful what you name your mailing list

Raymond Chen
Raymond Chen

Some time ago, I recommended exercising caution when choosing the name for your product group. The same caution applies to the name of your mailing list. Thanks to the large number of spammers out there, creating a mailling list whose account name is a word from the dictionary is just asking for trouble. When you create a new mailing list at Microsoft, the mailing list, by default, accepts mail from outside the company. Most people don't realize this; as a result, when a message comes in to a mailing list from outside Microsoft, people on the mailing list may reply to it, unaware that the person on the "From" ...

How can SIGINT be safely delivered on the main thread?
Jul 28, 2008
Post comments count 0
Post likes count 0

How can SIGINT be safely delivered on the main thread?

Raymond Chen
Raymond Chen

Commenter AnotherMatt wonders why Win32 console programs deliver console notifications on a different thread. Why doesn't it deliver them on the main thread? Actually, my question is the reverse. Why does unix deliver it on the main thread? It makes it nearly impossible to do anything of consequence inside the signal handler. The main thread might be inside the heap manager (holding the heap critical section) when the signal is raised. If the signal handler tried to access the heap, it would deadlock with itself if you're lucky, or just corrupt the heap if you aren't. For example, consider this signal hand...

Why seventh grade students want to go to weddings
Jul 25, 2008
Post comments count 0
Post likes count 0

Why seventh grade students want to go to weddings

Raymond Chen
Raymond Chen

My friend the seventh-grade teacher is getting married this summer, and when her students learned about the impending nuptials, they couldn't contain their excitement. The students asked her if there was going to be a chocolate fountain. Because you can't not have a chocolate fountain. When they learned that, no, there will not be a chocolate fountain, the students lobbied hard for her to reconsider and please, you have to have a chocolate fountain. The concept of a fancy party without a chocolate fountain defied comprehension. I mean, isn't a chocolate fountain the definition of a fancy party? Naturally, ...

Simulating a drop, part two
Jul 25, 2008
Post comments count 0
Post likes count 0

Simulating a drop, part two

Raymond Chen
Raymond Chen

Last time, we wrote a tiny program to simulate dropping a file on another file, but we discovered that it didn't work for dropping a file onto Mail Recipient.MAPIMail. The reason, as you no doubt instantly recognized, is that the MAPIMail handler creates a worker thread, and we're exiting the process before the worker thread has finished its work. And as you no doubt know by now, the solution is to use the SHSetInstanceExplorer function. Let's bring back the ProcessReference class and use it to solve our process lifetime problem. int __cdecl wmain(int argc, WCHAR **argv) { ProcessReference ref; ... Comp...

Reading a contract from the other side: Simulating a drop
Jul 24, 2008
Post comments count 0
Post likes count 0

Reading a contract from the other side: Simulating a drop

Raymond Chen
Raymond Chen

Most people, when they think of the IDropTarget interface, think only of implementing a drop target. But you can read the contract from the other side, because the description of how a drag source interacts with a drop target tells you how to be a drag source. To summarize, the sequence of drop target operations go like this: IDropTarget::DragEnter is called to indicate that an object has been dragged into the drop target. If the drop target returns a failure code, then the drop operation ends immediately. Otherwise, IDropTarget::DragOver calls are made to advise the drop target as to the obj...

Things other people have written that have amused me
Jul 23, 2008
Post comments count 0
Post likes count 0

Things other people have written that have amused me

Raymond Chen
Raymond Chen

I occasionally post things I've written that have amused other people, but today I'm going to share something Betsy Aoki wrote that amused me. On one of our internal mailing lists, somebody wondered why we don't use email spam filters to attack comment spam and trackback spam. My point was that the goal of email spam is very different from the goals of comment spam and trackback spam: I concluded with the remark, "I am not aware of any email spam that takes messages that I wrote and forwards them back to me." Betsy replied, "I encounter this all the time. It's called working at Microsoft."

Theorize if you want, but if the problem is right there in front of you, why not go for the facts?
Jul 23, 2008
Post comments count 0
Post likes count 0

Theorize if you want, but if the problem is right there in front of you, why not go for the facts?

Raymond Chen
Raymond Chen

On an internal discussion list, somebody asked a question similar to this: My program launches a helper program. This helper program does different things based on the command line parameters, but the way I'm using it, it just prints its results to the console and exits. When I launch this program and wait for it to exit, my wait never completes. Why isn't the helper program exiting? Here's the code that I'm using to launch the helper process... It wasn't long before people chimed in with their suggestions. Have your main program call exit() at the end. If you're redirecting stdout, you may be forgetti...

The Microsoft Company Picnic has as a side effect a demonstration of Microsoft’s rich cultural diversity
Jul 22, 2008
Post comments count 0
Post likes count 0

The Microsoft Company Picnic has as a side effect a demonstration of Microsoft’s rich cultural diversity

Raymond Chen
Raymond Chen

You hear parents scolding their kids in so many different languages.