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++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01