Microspeak: Take-away

At Microsoft, the take-away is the essential message of a presentation or the conclusion that you are expected to draw from a situation. It is something you are expected to remember when the whole thing is over, a piece of information you take away with you as you leave the room. XYZ demo take away…


What were Get/SetMessageExtraInfo ever used for?

KJK::Hyperion asks, “Could you shed some light on Get/SetMessageExtraInfo? It’s almost like nobody on earth used them, ever, and I can’t get some sample code.” Yup, that’s about right. Nobody on earth (to within experimental error) ever used them. These functions were introduced on July 20, 1990 (I’m looking at the change history right now)…


Watching the game of Telephone play out in five seconds

Some time ago, I spent the Thanksgiving holiday with my nieces (ages 3 and 5 at the time), and I overheard this conversation between them. “Thanksgiving is over.” — Christmas is coming! “It’s Christmas time!” — Today is Christmas!


The easy way out is to just answer the question: What is the current Explorer window looking at?

A customer had the following question: We have an application which copies and pastes files. Our problem is that we want to paste the files into the folder which corresponds to the currently active Windows Explorer window. Right now, we’re using SendKeys.SendWait(“^(v)”), but we find this method unsatisfactory because we want to replace Explorer’s default…


What if two programs did this? Practical exam

A customer who doesn’t read this blog had the following question: The requirement for our application is that it must be on top of all other windows, even in the presence of other windows with the topmost style. In our WM_KILLFOCUS and WM_PAINT messages, we set ourselves to topmost, and then call SetWindowPos to bring…


You can filter the Common File dialog with wildcards

A customer reported an apparent inconsistency in the shell common file dialogs: The question mark appears to be treated differently from other invalid file name characters. I tried to save a file in Paint under the name ?.jpg but instead of telling me that I had an invalid character in the file name (as it…


But who’s going to set up their own email server?

Many many years ago, back in the days when Microsoft’s email address had exclamation points, an internal tool was developed to permit Microsoft employees to view and update their Benefits information from the comfort of their very own offices. Welcome to the paperless office! One of my friends noticed an odd sentence in the instructions…


Consequences of using variables declared __declspec(thread)

As a prerequisite, I am going to assume that you understand how TLS works, and in particular how __declspec(thread) variables work. There’s a quite thorough treatise on the subject by Ken Johnson (better known as Skywing), who comments quite frequently on this site. The series starts here and continues for a total of 8 installments,…


What’s the difference between the Windows directory and the System directory?

(Windows was released on November 20, 1985, twenty-five years ago tomorrow. Happy birthday!) You have GetWindowsDirectory and you have GetSystemDirectory. Why do we need both? They’re both read-only directories. They are both searched by LoadLibrary. They seem to be redundant. (There are other directories like GetWindowsSystemDirectory which are not relevant to the discussion.) Back in…


One possible reason why ShellExecute returns SE_ERR_ACCESSDENIED and ShellExecuteEx returns ERROR_ACCESS_DENIED

(The strangely-phrased subject line is for search engine optimization.) A customer reported that when they called ShellExecute, the function sometimes fails with SE_ERR_ACCESSDENIED, depending on what they are trying to execute. (If they had tried ShellExecuteEx they would have gotten the error ERROR_ACCESS_DENIED.) After a good amount of back-and-forth examing file type registrations, a member…