GetUserDefaultLangID,GetSystemDefaultLangID,GetUserDefaultUILanguage比较

来源:互联网 发布:金山毒霸网络测速 编辑:程序博客网 时间:2024/05/17 23:08

这三个函数都是得到语言ID,但是使用的场合上却是有所不同,下面先给出三个函数的原型和解释:
GetUserDefaultLangID
Returns the language identifier for the current user locale.

LANGID GetUserDefaultLangID(void);
Parameters
This function has no parameters.

Return Values
Returns the language identifier for the current user locale.

GetSystemDefaultLangID
Returns the language identifier for the system locale.

LANGID GetSystemDefaultLangID(void);
Parameters
This function has no parameters.

Return Values
Returns the language identifier for the system locale.

 

GetUserDefaultUILanguage
Retrieves the user UI language for the current user. If the current user has not set a language, GetUserDefaultUILanguage returns the language identifier for the system default UI language.

LANGID GetUserDefaultUILanguage(void);
Parameters
This function has no parameters.

Return Value
Returns the language identifier for the user UI language for the current user.

要理解这三个函数的使用先要看看控制面板->区域和语言选项,
第一页代表数字货币时间,第二页是系统UI和软件界面,第三页高级是非unicode程序界面语言。
下面是这三个页面设置时,不同的函数的结果:
                                                      区域选项(变化)       语言 (变化)         高级(变化) 
GetUserDefaultLangID                 改变                     不变                    不变     
GetSystemDefaultLangID            不变                       不变                   改变
GetUserDefaultUILanguage        不变                        改变                  不变
由些可见,GetUserDefaultUILanguage会和系统UI的语言一致,所以我们建议在写UNICODE程序界面时用这个
函数会好些,和OS的UI一致,不会让客人觉得很奇怪。注意第二页默认是不可以选语言的,需要用户自行安装多国语言包才行,重起系统有效。

在写Unicode UI的时候最好不要用系统的Dialog title bar,因为默认的dialog title bar 不能显示Korean,而对话框里却可以正常显示。自绘个标题比用系统的好。如果不要求马上换语言就有效,这个当然没关系。

原创粉丝点击