The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

The many ways of converting a string from one language to another
May 7, 2010
Post comments count 0
Post likes count 0

The many ways of converting a string from one language to another

Raymond Chen
Raymond Chen

A customer asked, "I'm looking for a way to convert English characters to another language. For example, if the target language is Arabic and the string is the word Hello, I want it to convert to H(Arabic)e(Arabic)l(Arabic)l(Arabic)o(Arabic)." The question is still vague, even with the assistance of the example, since it's not clear what "H(Arabic)" means. There are a variety of ways of converting a string from one language to another. Here are a few I was able to think of. As it turns out, the customer wasn't interested in any of these! What the customer wanted was, "Take the word Hello and imagine how you...

On the Portuguese custom of the couvert, and other restaurant customs
May 6, 2010
Post comments count 0
Post likes count 0

On the Portuguese custom of the couvert, and other restaurant customs

Raymond Chen
Raymond Chen

In restaurants in the United States, the custom is that anything brought to the table that you didn't order is complimentary. For example, after you place your order, the waiter returns to your table with a basket of bread. The bread is provided at no extra charge. These complimentary items are usually small, like some bread or a one-bite appetizer. (If anything bigger is brought to the table that you didn't request, it is customary to ask the waiter, "Is this ours?" just to make sure it wasn't delivered to the wrong table by mistake.) In Portugal, the custom is that these items (known as couvert) are brought to...

What are these strange =C: environment variables?
May 6, 2010
Post comments count 0
Post likes count 0

What are these strange =C: environment variables?

Raymond Chen
Raymond Chen

You won't see them when you execute a command, but if you write a program that manually enumerates all the environment variables and prints them out, and if you launch it from a command prompt, then you'll see weird variables with names like =C: and whose values correspond to directories on that drive. What are these things? These variables are part of the private bookkeeping of the command processor cmd.exe. That's why I added if you launch it from a command prompt to the steps above, because if you run the program from Explorer's Run dialog, you won't see them. If a cmd.exe is not in the chain of custody of...

Eating where the teenagers are: Pão Pão, Queijo Queijo
May 5, 2010
Post comments count 0
Post likes count 0

Eating where the teenagers are: Pão Pão, Queijo Queijo

Raymond Chen
Raymond Chen

In Belém, directly to the east of the Mosteiro dos Jerónimos is a block of small shops, the most famous one of which being the Pastéis de Belém which sells the, um, Pastel de Belém, the Belém version of the unofficial dessert of Portugal. (This photo of a group of people eating was taken in front of the Pastéis de Belém shop. You can see the blue awnings in the background.) The place is always packed shoulder-to-shoulder with tourists. So turn around, leave the store, and walk back toward the Mosteiro dos Jerónimos. At about where the pink buildin...

How the shell converts an icon location into an icon
May 5, 2010
Post comments count 0
Post likes count 1

How the shell converts an icon location into an icon

Raymond Chen
Raymond Chen

A customer had trouble getting an icon to display for a registered file type. In my resource file, I specify the icon like this: And when I register my file type, I set it like this: However, when I view an .xyz file, my awesome icon doesn't appear. On the other hand, if I change the 101 to a 0, then it works. Why? Isn't the number in the resource file the resource ID? Why yes, in fact, the number in the resource file is indeed the resource ID. But the number after the comma in the isn't. The format of shell icon locations (used most visibly by , but also used in other places) is , where...

Microspeak: The statistic known as BIS
May 4, 2010
Post comments count 0
Post likes count 0

Microspeak: The statistic known as BIS

Raymond Chen
Raymond Chen

I learned this term from a chart presented at a team meeting. It contained a column labelled BIS. When asked what those letters meant, the team manager explained that it's an abbreviation for butts in seats. Everybody in the room instantly understood. It is the number of actual human beings sitting at desks doing work. When doing project planning, you sometimes get carried away with the imaginary people who would be working on your project someday, treating them as if they were real people: coming up with features for these imaginary people to work on, projecting how many bugs these imaginary people will fix, lo...

Welcome to Belém, the scam artist capital of Lisbon
May 3, 2010
Post comments count 0
Post likes count 0

Welcome to Belém, the scam artist capital of Lisbon

Raymond Chen
Raymond Chen

It has been quite a while since I was in Lisbon for a conference, but I still have a bunch of tiny travel stories. They may not be timely, but they're just stories. Lisbon is a wonderful city, and unlike Madrid, it doesn't have the feeling that it's overrun with tourists. It may very well be overrun with tourists, but at least it doesn't scream it at you. Well, until you get to the Belém neighborhood, which is where all the big monuments and famous historical buildings are. The sense begins to grow at the Padrão dos Descobrimentos (Monument to the Discoveries), and by the time you reach the To...

How do I accept files to be opened via IDropTarget instead of on the command line?
May 3, 2010
Post comments count 0
Post likes count 0

How do I accept files to be opened via IDropTarget instead of on the command line?

Raymond Chen
Raymond Chen

Commenter Yaron wants to know how to use the new IDropTarget mechanism for receiving a list of files to open. (Also asked by Anthony Wieser as a comment to an article.) The MSDN documentation on Verbs and File Assocations mentions that DDE has been deprecated as a way of launching documents and that you should use the DropTarget method instead. But what is the DropTarget method? (Note that the word method here is in the sense of technique and not in the C++ sense of function that belongs to a class.) The documentation in MSDN tells you what to do, but it does so very tersely. It says to create a key under ...

Welcome to Taiwan's premier English-only nightclub
Apr 30, 2010
Post comments count 0
Post likes count 0

Welcome to Taiwan's premier English-only nightclub

Raymond Chen
Raymond Chen

One of my friends is fluent in both Mandarin and English. When she lived in Taiwan, she paid a visit to a nightclub whose gimmick was that you had to speak English. The target audience was not foreigners but rather native Taiwanese who learned English as a second language. My friend didn't have any problems with this rule, but many of the guests appeared to be struggling to conform. My friend paid a visit to the ladies' room, and there she overheard a conversation between two other guests. (They were speaking in Mandarin. Apparently, the rules aren't enforced in the bathroom.) "There's this cute guy out on the ...