It's on, and you are invited....

by Michael S. Kaplan, published on 2005/07/01 11:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/07/01/434665.aspx


Early last month, a developer at Microsoft asked:

Where can I find information on what locale uses what paper sizes? Basically looking for info on what locales use Letter vs. A4.

Now there is one place to look any time you want information on Windows about a locale -- the clearinghose, grocery store function that lets you find anything you need to:

GetLocaleInfo

The topic that this function links to named Locale Information (which has never itself been in the MSDN index for reasons I cannot fathom, but it is a link away through this function and SetLocaleInfo so I do not worry too much).

Now this topic does have a ton of information in it; a lot of locale information has been added over the years. In this case, a simple search for the term "A4" finds what you want:

LOCALE_IPAPERSIZE
Windows 2000/XP: Default paper size associated with the locale. The specifier can be one of the following values.

Value        

Meaning

1

US Letter

5

US legal

8

A3

9

A4

And there it is!

Now as I said this function has a lot of stuff in it, so it is always easy to query for all sorts of information. You can even get the localized name of the current sort (hint: take a look at LOCALE_SSORTNAME!).

So take a look, treat it like a surprise party with a lot of cool presents, some that will not be interesting but others that will make your day.

So the next time you want to know if there is a particular bit of information in which you have interest, the party's on -- take a look and see what Uncle Bill has for you!

 

This post brought to you by "Ɛ" (U+0190, a.k.a. LATIN CAPITAL LETTER OPEN E)


# Michael S. Kaplan on 1 Jul 2005 11:10 AM:

And I'll cover some of the interesting ins and outs of GetLocaleInfo and some of its eccentricities another day....

# Maurits [MSFT] on 1 Jul 2005 11:24 AM:

According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_8otv.asp

the letter h in the time format string is converted to the hour (1-12, no leading zero)

How do you specify a literal h, for military time? (like right now it's 08h23 - eight hundred twenty-three hours)

# Primoz Gabrijelcic on 1 Jul 2005 4:59 PM:

There is a locale using A3 as a default paper???

# Michael S. Kaplan on 1 Jul 2005 5:01 PM:

<P>Hi Maurits, </P>
<P>Any time you want a literal string, the safest way to do it is to surround the literal with single quotes. Although technically you only are required to do this for strings that would conflict with tokens that have specific meanings (like h does), but in practice if you alaways do it then you won't ever accidentally conflict. Thus you could use something like "HH'h'mm" to get the time you want....</P>

# Michael S. Kaplan on 1 Jul 2005 5:05 PM:

Hi Primoz,

Not sure, but it is easy to check by combining an EnumSystemLocales call with a call to GetLocaleInfo with the LCMAP_IPAPERSIZE flag. :-)

Note that this is a setting you can change through SetLocaleInfo (though not through Regional Options), so one could always get their machine customized to use A3 if they wanted....

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day