0

I'm trying to find out how the "regional format" setting on Windows 10 can be retrieved (see picture below).

I tried GetLocaleInfoEx, with virtually all combinations of parameters, but this one showed up nowhere.

On the other hand this setting has an influence on what's returned by GetThreadLocale:

Some examples with expected return values from GetThreadLocale as per this Microsoft documentation, C++ code at the end of the question.

+--------------------------+-----------------------------------+
|     Regional format      | Value returned by GetThreadLocale |
+--------------------------+-----------------------------------+
| French (Switzerland)     | 0x100c                            |
| French (France)          | 0x040c                            |
| German (Germany)         | 0x0407                            |
| English (United states)  | 0x0409                            |
| English (United Kingdom) | 0x0809                            |
+--------------------------+-----------------------------------+

Some examples with unexpected (and undocumented) return values from GetThreadLocale:

+-----------------------+-----------------------------------+
|    Regional format    | Value returned by GetThreadLocale |
+-----------------------+-----------------------------------+
| English (Switzerland) | 0x0c00                            |
| English (Germany)     | 0x0c00                            |
| German (Italy)        | 0x0c00                            |
+-----------------------+-----------------------------------+

I really wonder what this 0x0c00 value returned by GetThreadLocale is?


enter image description here

C++ code

#include <windows.h>
#include <stdio.h>

int main()
{
  printf("GetThreadLocale: %08x\n", GetThreadLocale());
}
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • 2
    0x0C00 is LOCALE_CUSTOM_DEFAULT – Simon Mourier Mar 04 '20 at 14:29
  • 1
    `0x0c00` is the first entry of the table in your link [this Microsoft documentation](https://learn.microsoft.com/fr-ch/windows/win32/intl/language-identifier-constants-and-strings) ;-) – Scheff's Cat Mar 04 '20 at 14:32
  • @Scheff err yes, not sure how I could miss this, but it still doesn't explain the main part of the question. – Jabberwocky Mar 04 '20 at 14:41
  • 1
    Actually, the `English (Switzerland)` looks a bit suspicious to me as well as `German (Italy)` (although, the latter let me guess something special for Südtirol with a bit of fantasy). Sorry, I don't have a substantial idea about this. At least, I found this Q/A: [SO: GetThreadLocale returns different value than GetUserDefaultLCID?](https://stackoverflow.com/a/2947349/7478597) (although it was about Windows 7). – Scheff's Cat Mar 04 '20 at 14:49
  • 1
    @Scheff yes "English (Switzerland)" is rather odd, but with this setting, you can have an english calandar (the one you have in Windows 10 at the bottom right on the screen) on a german, french or whatever Windows. Not the most useful feature though. – Jabberwocky Mar 04 '20 at 14:56
  • 1
    LCID is deprecated, you need [GetUserDefaultLocaleName()](https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getuserdefaultlocalename). It notes that there is no replacement for the thread locale, quite hard to make it compatible because it is part of the TEB and too many programs directly access it. – Hans Passant Mar 04 '20 at 15:19
  • 1
    @HansPassant yes, `GetUserDefaultLocaleName()` returns strings that are consistent with the regional format setting. Your comment is actually an answer. – Jabberwocky Mar 04 '20 at 15:28
  • @Jabberwocky If you have a solution, please post an answer and mark it. – Strive Sun Mar 05 '20 at 08:45

0 Answers0