How to get OS language using C++ API?(如何使用 C++ API 获取操作系统语言?)
问题描述
我正在开发一个根据操作系统语言显示对话框的应用程序.如何使用 C++ 或 Windows API (Windows 2008/Vista/7) 获取操作系统语言?
I am in the process of developing a application which displays dialogs depending on the OS language. How I can get the OS language using C++ or Windows APIs (Windows 2008/Vista/7)?
推荐答案
在 Windows 中有几个函数可以做到这一点,具体取决于您想要的信息格式.在 Windows Vista 之前,语言信息被编码为 LCID(Locale Id),包括语言,以及一些关于排序和格式的信息.
There are several functions to do this in Windows, depending on what format you want the information in. Prior to Windows Vista, the language information was encoded into a LCID (Locale Id) which includes language, as well as some information about sorting and formatting.
对于 Windows Vista 和 Windows 7,设计了一个更灵活的系统,称为区域设置名称.GetSystemDefaultLocaleName
For Windows Vista and Windows 7, a more flexible system called Locale Names was devised. GetSystemDefaultLocaleName
如果您想在 Win2k 和 WinXP 上工作,请使用此选项.GetSystemDefaultLCID
Use this if you want to work on Win2k and WinXP. GetSystemDefaultLCID
这篇关于如何使用 C++ API 获取操作系统语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 C++ API 获取操作系统语言?
基础教程推荐
- 初始化列表*参数*评估顺序 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- CString 到 char* 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
