Don't let more than one process try to read from stdin at the same time
A customer reported a problem with a program that ran a series of other programs in parallel. We have a main program (call it main.exe) that runs a bunch of child processes with stdout and stderr...
View ArticleWhy does my program still show up in the Programs and Features folder after...
A customer reported that they were having problems with their program entry in the Programs and Features folder (formerly known as Add and Remove Programs, formerly known as Add/Remove Programs). When...
View ArticleA feature I didn't even know existed much less had a name: Color hot-track
I hadn't even noticed this until somebody pointed it out: When you hover your mouse over a button in the Windows 7 taskbar which corresponds to a running application, the taskbar button lights up in a...
View ArticleGetParent, just as confusing as EnumClaw, but it's an actual function!
The function EnumÂClaw, documented as returning "the child or the parent of the window", was a joke, but there's a function whose behavior is just as confusing as the joke function EnumÂClaw:...
View ArticleWhat does it mean when my program exits with the message "This application...
You're running your program, and then it suddenly exits with the message This application has requested the Runtime to terminate it in an unusual way. What happened? That message is printed by the C...
View ArticleSure, I'm supposed to pass WT_EXECUTELONGFUNCTION if my function takes a long...
A customer contacted me to tell a story and ask a question. The customer discovered that in their code base, all calls to QueueÂUserÂWorkÂItem passed the WT_EXECUTEÂLONGÂFUNCTION flag, regardless of...
View ArticleHow can I tell whether a window is modal?
A customer wanted a way to determine whether a particular window is modal. They listed a few methods they had tried but found that it didn't work and asked for assistance. As Eric Lippert is fond of...
View ArticleWhat is the API for accessing content on SkyDrive?
The last time I mentioned programmatic access to SkyDrive was last June, where I noted that the interface was given the confusing name Messenger Connect. At least now they renamed it to Live Connect,...
View ArticleOnline gift ordering + enthusiastic kids at the keyboard + Unicode, wait......
I was completing an online gift order for my young nephew's birthday, and I was in the middle of typing Happy birthday into the gift card message when an enthusiastic child reached for the keyboard...
View ArticleThe peculiar cadence of executive mail messages
When there's a piece of mail sent from a senior executive to the entire product team, it tends to follow a set pattern. It starts out with a history of Group X and commends them on what a great job...
View ArticleNot even making it to the airtight hatchway: Execution even before you get there
Today's dubious security vulnerability comes from somebody who reported that the LoadÂKeyboardÂLayout function had a security vulnerability which could lead to arbitrary code execution. This is a...
View ArticleProgrammatically controlling which handles are inherited by new processes in...
In unix, file descriptors are inherited by child processes by default. This wasn't so much an active decision as it was a consequence of the fork/exec model. To exclude a file descriptor from being...
View ArticlePaint messages will come in as fast as you let them
There is a class of messages which are generated on demand rather than explicitly posted into a message queue. If you call GetÂMessage or PeekÂMessage and the queue is empty, then the window manager...
View ArticleMicrospeak: Offline (noun)
Sure, any noun can be verbed, and any verb can be nouned. But today, we're going to noun an adjective. I have no written citations of this usage; the only report was via a colleague who overheard it...
View ArticleDeftly solving compatibility problems by withholding information
One of the continuing compatibility problems that plagued Direct3D was the way it reported texture formats. Historically, the way an application checked which texture formats were available was by...
View ArticleHow do I determine programmatically whether a particular language is LTR or RTL?
Given an LCID, how does one determine whether the language lays out left-to-right or right-to-left? One suggestion was simply to hard-code the list of known right-to-left languages, and if the...
View ArticleHow do I get the full path for the target of a shortcut file?
A customer was having trouble obtaining information from a shortcut file. "Here is a sample program that tries to print the target of a shortcut file, but it only gets the file name without a...
View ArticleWhy is the file size reported incorrectly for files that are still being...
The shell team often gets questions like these from customers: Attached please find a sample program which continuously writes data to a file. If you open the folder containing the file in Explorer,...
View ArticleCelebrating the end of the gluttony season, but the effects linger
The Washington State Ferry system has reduced the rated carrying capacity of its fleet because people have gotten fatter: The average weight of an adult passenger has been officially revised from 160...
View ArticleIntroducing the for-if anti-pattern
Over the years, I've seen a bunch of coding anti-patterns. I figured maybe I'll share a few. Today, I'll introduce what I'm calling the for-if anti-pattern, also known as "We'll sell you the whole...
View Article