Advertisement

windows客户端开发--为国际化做准备

阅读量:

一款好的windows client,当然要做国际化。

今天先介绍几个函数,获取windows操作系统的使用语言。

GetSystemDefaultLCID函数
这个函数很简单,没有参数,只有返回值:
Returns the locale identifier for the system locale

GetSystemDefaultUILanguage

复制代码
    Retrieves the language identifier for the system default UI language of the operating system, also known as the "install language" on Windows Vista and later. For more information, see User Interface Language Management.

GetUserDefaultUILanguage
Returns the language identifier for the user UI language for the current user. If the current user has not set a language, GetUserDefaultUILanguage returns the preferred language set for the system. If there is no preferred language set for the system, then the system default UI language (also known as “install language”) is returned. For more information about the user UI language, see User Interface Language Management.
原型:

复制代码
    LANGID GetUserDefaultUILanguage(void);
复制代码
    #include<iostream>
    #include<Windows.h>
    #pragma comment(lib, "Kernel32.lib")
    int main()
    {
    auto iter = GetUserDefaultUILanguage();
    auto iter2 = GetSystemDefaultUILanguage();
    std::cout << iter << std::endl;
    std::cout << iter2 << std::endl;
    return 0;
    }
    //输出:
    //2052
    //2052

返回值LANGID 是什么:

Arabic
1025
Arabic

Basque
1069
ANSI

Catalan
1027
ANSI

Chinese (Simplified)
2052
GB2312

Chinese (Traditional)
1028
Chinese-Big 5

Czech
1029
Eastern European

Danish
1030
ANSI

Dutch
1043
ANSI

English (United States)
1033
ANSI

Finnish
1035
ANSI

French
1036
ANSI

German
1031
ANSI

Greek
1032
Greek

Hebrew
1037
Hebrew

Hungarian
1038
Eastern European

Italian
1040
ANSI

Japanese
1041
Shift-JIS

Korean
1042
Johab

Norwegian
1044
ANSI

Polish
1045
Eastern European

Portuguese
2070
ANSI

Portuguese (Brazil)
1046
ANSI

Russian
1049
Russian

Slovakian
1051
Eastern European

Slovenian
1060
Eastern European

Spanish
3082
ANSI

Swedish
1053
ANSI

Turkish
1055
Turkish

另外,如果vs出现这样的错误:
error LNK2001: 无法解析的外部符号 _WinMain@16

链接器-系统-子系统-选择工作台

全部评论 (0)

还没有任何评论哟~