如何使用C ++ API获得OS语言? [英] How to get OS language using C++ API?
问题描述
我正在开发一个应用程序,该应用程序根据OS语言显示对话框。如何使用C ++或Windows API(Windows 2008 / Vista / 7)获得OS语言?
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(语言环境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,设计了一个更灵活的系统,称为Locale Names。
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获得OS语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!