开发者

How do I determine the user's language in Visual C++?

I've been searching msdn forever now without a straight answer.

Is there a way to simply get the user's language? I don't want to load any resources or anything at this point, I just want to get their language. Is there ANY simple way to do this?

I'm using visual C++,and I'm not using MFC or 开发者_如何转开发anything like that.


What about GetUserDefaultUILanguage?

Word of caution: Never mistake the user's locale for their UI language. There are already enough broken applications out there.


GetUserDefaultLangID may be what you're after. Then again, you may really be after GetUserPreferredUILanguages.


GetUserDefaultLCID or GetUserDefaultLocaleName on Vista will return the LCID/locale name of the user's default locale.

You can then use GetLocaleInfo or GetLocaleInfoEx on Vista to get the display name of the locale (either LOCALE_SENGLISHDISPLAYNAME for the english name or LOCALE_SLOCALIZEDDISPLAYNAME for the localized name).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜