关于MFC使用多语言的问题
再使用MFC框架编程时,实现多语言也有很多方案,我个人采取了一个相对简单的方案,即一个ID多份不同语言的资源副本,在Windows NT 3.1及之后版本可以使用SetThreadLocale手工修改UI显示语言,在Vista之后的版本可以使用SetThreadUILanguage方法手工修改UI显示语言,本人采用这种方式可以达到预期的效果,只是这里有一个疑问,在MSDN上明确指出Windwos 2000/xp 不应该使用SetThreadLocale去选择UI语言,而应该使用FindResourceEx,原文如下:
The SetThreadLocale function affects the selection of resources that are defined with a LANGUAGE statement. This affects such functions as CreateDialog, DialogBox, LoadMenu, LoadString, and FindResource, and sets the code page implied by CP_THREAD_ACP, but does not affect FindResourceEx.
Windows 2000/XP: Do not use SetThreadLocale to select a UI language. To select the proper resource that is defined with a LANGUAGE statement, use FindResourceEx.
这里并没有解释原因,实际使用中如果使用FindResourceEx编码量会大很多,而且直接使用SetThreadLocale完全可以实现预期的目的,这里是很迷惑的地方,请各位了解其原因的朋友指导一下~谢谢!
The SetThreadLocale function affects the selection of resources that are defined with a LANGUAGE statement. This affects such functions as CreateDialog, DialogBox, LoadMenu, LoadString, and FindResource, and sets the code page implied by CP_THREAD_ACP, but does not affect FindResourceEx.
Windows 2000/XP: Do not use SetThreadLocale to select a UI language. To select the proper resource that is defined with a LANGUAGE statement, use FindResourceEx.
这里并没有解释原因,实际使用中如果使用FindResourceEx编码量会大很多,而且直接使用SetThreadLocale完全可以实现预期的目的,这里是很迷惑的地方,请各位了解其原因的朋友指导一下~谢谢!
...全文
相关推荐
多语言切换DLL版
多种语言分别生成多个资源DLL,方便开发多语言程序
MFC多语言界面切换
通过菜单中选择进行中英文的实时切换,适用于win7+vs2010
MFC多语言实现方法
三个例子,博客文章中有简单介绍。 仅仅是列出一个思路,用ini的那个例子里面对于多级菜单的遍历应该用byposition存取或读取较好,但又会存在命名问题。 仅参考。
MFC 多语言环境的实现
MFC 多语言环境的实现,VS2015的工程,如果有疑问可见博客文章 http://blog.csdn.net/weixinhum/article/details/51202263
多语言支持(C++mfc/c#)
多语言程序,包括C++(mfc)和C#各几种实现方法,非常有借鉴价值。


资源
