How to set the culture info in unmanaged C++?

◇◆丶佛笑我妖孽 提交于 2019-12-11 02:24:27

问题


I got a program written in unmanaged C++, I need to get the cultural info from the system and set that info to the current execution thread in my c++ application.

Thanks.


回答1:


In unmanaged C++ on windows, what you need is the Locale. Culture is a term defined in .NET, as a replacement for that term.

There's a whole host of functions, but the one where you need to start is called SetThreadLocale.

SetThreadLocale Function (Windows) @ MSDN

Within the documentation at MSDN, it appears that there are quirks in Vista. You may wish to consult the following function as well.

SetThreadUILanguage Function (Windows) @ MSDN

The other functions of interest are available here.

National Language Support Functions (Windows) @ MSDN
Multilingual User Interface Functions (Windows) @ MSDN

edit:

If you are developing an application with really basic support, setlocale() may also be of interest.

setlocale (C/C++) @ MSDN



来源:https://stackoverflow.com/questions/1759612/how-to-set-the-culture-info-in-unmanaged-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!