Windows 2003中的unicode [英] unicode in windows 2003

查看:84
本文介绍了Windows 2003中的unicode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我创建一个简单的win32项目(VC2003,windows2003(英文),

并在WM_PAINT消息中做简单绘制,当项目使用时

多字符集,没关系。

但是当我换成UNICODE时,一些中文字符难以辨认(我看到

sizeof( TCHAR)= 2正在显示)。欢迎您的想法。


案例WM_PAINT:

hdc = BeginPaint(hWnd,& ps);

{

LPCTSTR smsg = _T(" pring?D ??");

TextOut(hdc,0,0,smsg,_tcslen( smsg));

TCHAR buf [256];

wsprintf(buf,_T(" sizeof(TCHAR)=%d"),sizeof(TCHAR));

TextOut(hdc,0,20,buf,_tcslen(buf));

}

EndPaint(hWnd,& ps);

休息;


最好的问候

Onega

Hi

I create a simple win32 project (VC2003, windows2003(English) ,
and do simple paint in WM_PAINT message, when the project use
multi-character set, it is OK.
but when I change to UNICODE, some Chinese characters are illegible( I see
sizeof(TCHAR)=2 being displayed). Your idea is welcome.

case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
{
LPCTSTR smsg = _T("pring?D??");
TextOut(hdc,0,0,smsg, _tcslen(smsg));
TCHAR buf[256];
wsprintf(buf, _T("sizeof(TCHAR)=%d"), sizeof(TCHAR));
TextOut(hdc,0,20,buf, _tcslen(buf));
}
EndPaint(hWnd, &ps);
break;

Best Regards
Onega

推荐答案

>>欢迎您的想法。

为什么仍然使用win32进行新项目?是否需要修改现有的

appli对于我推荐使用.NET窗口应用程序项目的新项目,请使用


这些使用起来更简单。

亲切的问候,

Bruno。
>>Your idea is welcome.
why still use win32 for a new project? do you need to modify an existing
application?

for new projects i would recommend using a .NET windows application project.
these are MUCH simpler to use.

kind regards,
Bruno.


我认为当编译为Unicode时,字符串中的字符

literal将被解释为一个Unicode字符。您可能希望使用\ x转义序列来查看



" Onega" <无**** @ test.com>在留言中写道

新闻:eI ************** @ tk2msftngp13.phx.gbl ...
I would assume that when compiled as Unicode, the characters in your string
literal will each be interpreted as one Unicode character. You might want to
look at using the \x escape sequence.

"Onega" <no****@test.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...


我创建了一个简单的win32项目(VC2003,windows2003(英文),
并在WM_PAINT消息中做简单绘画,当项目使用多字符集时,就可以了。
但是当我改为UNICODE时,一些中文字符难以辨认(我看到
sizeof(TCHAR)= 2正在显示)。欢迎你的想法。

案例WM_PAINT:
hdc = BeginPaint(hWnd,& ps);
{> LPCTSTR smsg = _T(" pring?D ??");
TextOut(hdc,0,0,smsg, _tcslen(smsg));
TCHAR buf [256];
wsprintf(buf,_T(" sizeof(TCHAR)=%d"),sizeof(TCHAR));
TextOut( hdc,0,20,buf,_tcslen(buf));
}
EndPaint(hWnd,& ps);
休息;

最好的问候
Onega
Hi

I create a simple win32 project (VC2003, windows2003(English) ,
and do simple paint in WM_PAINT message, when the project use
multi-character set, it is OK.
but when I change to UNICODE, some Chinese characters are illegible( I see
sizeof(TCHAR)=2 being displayed). Your idea is welcome.

case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
{
LPCTSTR smsg = _T("pring?D??");
TextOut(hdc,0,0,smsg, _tcslen(smsg));
TCHAR buf[256];
wsprintf(buf, _T("sizeof(TCHAR)=%d"), sizeof(TCHAR));
TextOut(hdc,0,20,buf, _tcslen(buf));
}
EndPaint(hWnd, &ps);
break;

Best Regards
Onega



谢谢你,Ted Miller

\ x转义序列不友好。

我的代码片段w在Windows XP下运行良好。我想知道它是否是Windows 2003或VC 2003的错误




最好的问候

Onega


" Ted Miller" < te*@nwlink.com>在消息中写道

news:vt ************ @ corp.supernews.com ...
Thank you, Ted Miller
\x escape sequence is not friendly.
My code snippet works well under Windows XP. I''d like to know if it is a bug
of Windows 2003 or VC 2003?

Best Regards
Onega

"Ted Miller" <te*@nwlink.com> wrote in message
news:vt************@corp.supernews.com...
我会假设编译为Unicode,
字符串文字中的字符将被解释为一个Unicode字符。您可能需要
来查看使用\ x转义序列。

Onega <无**** @ test.com>在消息中写道
新闻:eI ************** @ tk2msftngp13.phx.gbl ...
I would assume that when compiled as Unicode, the characters in your string literal will each be interpreted as one Unicode character. You might want to look at using the \x escape sequence.

"Onega" <no****@test.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...


我创建了一个简单的win32项目(VC2003,windows2003(英文),
并在WM_PAINT消息中做简单的绘制,当项目使用多字符集时,没关系。
但是当我改为UNICODE,一些中文字符难以辨认(显示尺寸为(TCHAR)= 2的b $ b。)你的想法很受欢迎。

案例WM_PAINT:
hdc = BeginPaint( hWnd,& ps);
{> LPCTSTR smsg = _T(" pring?D ??");
TextOut(hdc,0,0,smsg,_tcslen(smsg) );;
TCHAR buf [256];
wsprintf(buf,_T(" sizeof(TCHAR)=%d"),sizeof(TCHAR));
TextOut(hdc,0, 20,buf,_tcslen(buf));
}
EndPaint(hWnd,& ps);
休息;

最好的问候
Onega
Hi

I create a simple win32 project (VC2003, windows2003(English) ,
and do simple paint in WM_PAINT message, when the project use
multi-character set, it is OK.
but when I change to UNICODE, some Chinese characters are illegible( I see sizeof(TCHAR)=2 being displayed). Your idea is welcome.

case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
{
LPCTSTR smsg = _T("pring?D??");
TextOut(hdc,0,0,smsg, _tcslen(smsg));
TCHAR buf[256];
wsprintf(buf, _T("sizeof(TCHAR)=%d"), sizeof(TCHAR));
TextOut(hdc,0,20,buf, _tcslen(buf));
}
EndPaint(hWnd, &ps);
break;

Best Regards
Onega




这篇关于Windows 2003中的unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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