首页 > 解决方案 > 如何在 Windows 10 中检索“区域格式”

问题描述

我正在尝试找出如何检索 Windows 10 上的“区域格式”设置(见下图)。

我试过GetLocaleInfoEx了,几乎所有的参数组合,但这个没有出现。

另一方面,此设置会影响返回的内容GetThreadLocale

GetThreadLocale根据此 Microsoft 文档,问题末尾的 C++ 代码中的一些具有预期返回值的示例。

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

一些具有意外(和未记录)返回值的示例来自GetThreadLocale

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

我真的很想知道这个0x0c00返回的值GetThreadLocale是什么?


在此处输入图像描述

C++ 代码

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

int main()
{
  printf("GetThreadLocale: %08x\n", GetThreadLocale());
}

标签: c++windowswinapi

解决方案


推荐阅读