The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Mar 20, 2014
Post comments count 0
Post likes count 1

When visitors to the United States underestimate the size of the country

Raymond Chen

A friend of mine who is from Lebanon (but now lives in Seattle) invited his grandmother to come visit for the summer. When she arrived, he asked her, "Grandma, is there anywhere in particular you would like to visit?" His grandmother replied, "I'd like go to to Washington, DC." "Okay, Grandma. Let me buy some plane tickets." "No, let's drive." "You want to drive all the way to Washington, DC? Here, let me show you on a map how far away it is." Grandma replied, "Let's do it." My friend said, "Okay, Grandma, we're going on a road trip!" He got the rest of the family on board with the plan, packed up the car, ...

Mar 20, 2014
Post comments count 0
Post likes count 1

Going for the facts: Who is displaying this message box?

Raymond Chen

A customer wanted to know whether had a problem with Unicode. A problem with it? Quite the contrary. loves Unicode! In fact, if you call the ANSI version, it converts the strings to Unicode and then finishes the work in Unicode. Okay, here's the customer's problem. We have a custom application written in managed code. When we launch the process from unmanaged code via , we sometimes get a bogus error message: WARNING! The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. The filena...

Mar 19, 2014
Post comments count 0
Post likes count 1

I think this person's monitor is broken: It doesn't know how to render text in capital letters

Raymond Chen

Some time ago, somebody asked a question about why, when they do 1 and 2, they get extra thing 3. "The extra 3 is there because of the 456 feature. BUT DO NOT DISABLE THE 456 FEATURE JUST BECAUSE YOU DON'T LIKE 3. The 456 feature is important, because it ensures that 2 runs to completion. Otherwise, you risk data loss." The person wrote back, "I disabled the 456 feature, and that fixed it. Thanks!" It appears that that person's monitor is broken: It doesn't know how to render text in capital letters.

Mar 18, 2014
Post comments count 0
Post likes count 0

Raymond's highly scientific predictions for the 2014 NCAA men's basketball tournament

Raymond Chen

Once again, it's time for Raymond to come up with an absurd, arbitrary criterion for filling out his NCAA bracket. This year, I look at the number of followers of of the basketball team's official Twitter account, or one tenth of the number of followers of the school's athletic department if the school's basketball team does not have its own dedicated Twitter account. The fraction 1/10 is completely arbitrary, but that's what makes this algorithm highly scientific. And yes, counting fans also includes people who hatewatch the team. I accept this, because if a lot of people hate a team, it's probably because...

Mar 18, 2014
Post comments count 0
Post likes count 1

Why do I have to hit an arrow key before a keyboard-initiated Move operation will follow the mouse?

Raymond Chen

TehShrike wonders why you have to hit an arrow key before a keyboard-initiated Move operation will follow the mouse. I don't know, but I think it's just a bug. Mind you, it's a bug with extraordinary seniority (probably going as far back as Windows 1.0). The Move and Size commands from the system menu are operated by the same common function, and the keyboard-initiated Size command requires you to hit an arrow in order to specify which edge you are trying to resize. The Move command doesn't need to let you pick a side (since moving is independent of sides), but the common helper function waits for the arr...

Mar 17, 2014
Post comments count 0
Post likes count 1

How do I show the contents of a directory while respecting the user's preferences for hidden and super-hidden files as well as the user's language preferences?

Raymond Chen

A customer was writing a program in (and this is what they said) "32 bit C++ .Net 4.0" which displayed the contents of a directory, and they wanted to filter out items such as hidden files and protected operating system files (also known as super-hidden files) based on the user's current Explorer preferences. Furthermore, they wanted to show localized folder names, such as Usarios instead of Users, again, the same way Explorer does. They are currently using . The way to do this is to use , the same way Explorer does. Don't pass or , and you will get the default enumeration that filters out hidden items based ...

Mar 14, 2014
Post comments count 0
Post likes count 1

How do I create an IShellItemArray from a bunch of file paths?

Raymond Chen

The interface accepts bulk operations in the form of an . So how do you take a list of file names and convert them into an ? There is no function, but there is a , and we know how to convert a path to an ID list, namely via . So lets snap two blocks together. The template function takes an array of paths and starts by creating a corresponding array of ID lists. (If you're feeling fancy, you can use a file system bind context to make simple ID lists.) It then pumps this array into the function to get the item array. Using a template allows you to pass an array of anything as the array of paths, as lo...

Mar 13, 2014
Post comments count 0
Post likes count 1

Why does the Directory.GetFiles method sometimes ignore *.html files when I ask for *.htm?

Raymond Chen

The documentation for the method says When using the asterisk wildcard character in a search­Pattern, such as "*.txt", the matching behavior when the extension is exactly three characters long is different than when the extension is more or less than three characters long. A search­Pattern with a file extension of exactly three characters returns files having an extension of three or more characters, where the first three characters match the file extension specified in the search­Pattern. A search­Pattern with a file extension of one, two, or more than three characters returns only files havin...

Mar 12, 2014
Post comments count 0
Post likes count 1

Operations jargon: Internet egress

Raymond Chen

As I've noted before, the operations team has their own jargon which superficially resembles English. Some time ago, they sent out a message with the subject A New Internet Egress Path Is Coming. Translation: We're changing the way computers access the Internet. Bonus jargon: traffic on the edge. This does not refer to traffic that is on the verge of a nervous breakdown. It merely refers to traffic that crosses the boundary between intranet and Internet.