7.1 MFC应用程序与6.0 MFC中的汉字字符显示 [英] Kanji character display in 7.1 MFC application vs. 6.0 MFC

查看:73
本文介绍了7.1 MFC应用程序与6.0 MFC中的汉字字符显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我们遇到的问题。一个用于

的应用程序成功显示日语汉字字符时不再用

重新编译7.1


当使用6.0编译器,以下两种方法都成功地在完全配置为日本机器的

a机器上的多行CEdit控件中显示日文字符(日文版)

Windows 2000 SP4)。使用7.1编译的相同代码仅显示空格或

不正确的字符。该程序是为MBCS而不是Unicode编译的,所以我们

实际上是在方法1中调用SetWindowTextA。


方法1:

=========

//为MBCS角色制作一个小缓冲区


TCHAR cPtr [6] ;

for(int i = 0; i< 6; i ++)cPtr [i] = 0;

int iRet = WideCharToMultiByte(932,0,L" \\ \\ x3042",1,cPtr,6,NULL,NULL);

//显示平假名A角色

m_cProblemEdit.SetWindowText(cPtr);


方法2:

=========


CString sProblem;

/ /...Iinitialize sProblem with Kanji string ....

//显示字符串

m_CProblemEditSetWindow(sProblem);

Here is the problem we''ve encountered. An application that used to
successfully display Japanese Kanji characters no longer does so when
recompiled with 7.1

When compiled with the 6.0 compiler, both of the following methods are
successful in displaying Japanese characters in a multi-line CEdit control on
a machine that is fully configured as a Japanese machine (Japanese version of
Windows 2000 SP4). The same code, compiled with 7.1, only displays blanks or
incorrect characters. The program is compiled for MBCS, not Unicode, so we
are in effect calling SetWindowTextA in Method 1.

METHOD 1:
=========

// Make a little buffer for the MBCS character

TCHAR cPtr[6];
for (int i = 0; i < 6; i++) cPtr[i] = 0;
int iRet = WideCharToMultiByte (932, 0, L"\x3042", 1, cPtr, 6, NULL, NULL);
// Display Hiragana A character
m_cProblemEdit.SetWindowText(cPtr);

METHOD 2:
=========

CString sProblem;
//...Iinitialize sProblem with Kanji string ....
// Display string
m_CProblemEditSetWindow(sProblem);

推荐答案


这是我们遇到的问题。用于成功显示日语汉字字符的应用程序
在使用7.1重新编译时不再这样做
Here is the problem we''ve encountered. An application
that used to successfully display Japanese Kanji characters
no longer does so when recompiled with 7.1




对于VC7.1项目,您需要指定其文化对于日语,这个

将使你的程序按预期显示日语汉字字符。


你可以在Project属性配置中配置它(Project Property

页数/资源/一般/文化)。

谢谢!


祝你好运,


Gary Chang

微软社区支持

--------------------

安全! ?§C www.microsoft.com/security

注册访问MSDN托管新闻组!
http://support.microsoft.com/default...sdn/nospam.asp

& SD = msdn


该帖子是按原样提供的。没有保证,也没有授予任何权利。



For a VC7.1 project, you need to specify its "Culture" to Japanese, this
will make your programdisplay the Japanese Kanji characters as expected.

You can configure it in the Project property configuration(Project Property
Pages/Resources/General/Culture).
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ?§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.




"" Gary Chang [MSFT]"" <,V - ****** @ online.microsoft.com>在消息中写道

新闻:BP ************** @ TK2MSFTNGXA01.phx.gbl ...

""Gary Chang[MSFT]"" <v-******@online.microsoft.com> wrote in message
news:BP**************@TK2MSFTNGXA01.phx.gbl...
这是我们遇到的问题。用于成功显示日语汉字字符的应用程序
在使用7.1重新编译时不再这样做
Here is the problem we''ve encountered. An application
that used to successfully display Japanese Kanji characters
no longer does so when recompiled with 7.1


对于VC7.1项目,您需要指定它"文化QUOT;对于日语,这将使你的程序按预期显示日语汉字字符。



For a VC7.1 project, you need to specify its "Culture" to Japanese, this
will make your programdisplay the Japanese Kanji characters as expected.




我对此感到有点困惑,但也许我不喜欢理解它。如果

应用程序应该与许多文化一起使用怎么办?而不只是

日本文化?只要一个人没有切换他们的默认(对于

非unicode应用程序)代码页,我们的应用程序将支持任何双字节语言。

听起来像是我们用VC7.1编译它不再。我错过了吗?
什么东西?


-Michael Viking



I''m a little baffled by this, but maybe I don''t understand it. What if the
application is supposed to work with many "cultures" and not just the
Japanese culture? As long as one doesn''t switch their default (for
non-unicode apps) code page, our app will support any double-byte language.
Sounds like if we compiled with VC7.1 it no longer would. Am I missing
something?

-Michael Viking


嗨迈克尔,
Hi Michael,
我对此感到有点困惑,但也许我不明白。
如果应用程序应该与许多文化一起工作怎么办?而不只是日本文化?
I''m a little baffled by this, but maybe I don''t understand it.
What if the application is supposed to work with many
"cultures" and not just the Japanese culture?




对于一般的.NET WinForm应用程序,您可以设置目标表单'

"本地化"如果属性为true,则在其语言中指定您需要的语言

support。属性,VS2003 IDE将分别生成

多语言支持资源文件。


但是在你的情况下,要指定项目'''Culture" ;属性是按顺序

告诉VS2003 IDE根据哪个语言区域设置来编译你的MFC

项目的资源,它与一般的.NET应用程序不同。

感谢您的理解!


祝你好运,


Gary Chang

微软社区支持

--------------------

安全! ?§C www.microsoft.com/security

注册访问MSDN托管新闻组!
http://support.microsoft.com/default...sdn/nospam.asp

& SD = msdn


该帖子是按原样提供的。没有保证,也没有授予任何权利。



For a general .NET WinForm application, you can set the target Form''s
"Localizable" property to true, then specify the language you need to
support in its "Language" property, the VS2003 IDE will generate the
multiple language support resource file respectively.

But in your case, to specify the project''s "Culture" property is in order
to tell the VS2003 IDE based on which language locale to compile your MFC
project''s resource, it is different with the general .NET application.
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ?§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.


这篇关于7.1 MFC应用程序与6.0 MFC中的汉字字符显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆