请教如何在控件上显示unicode编码的字符,如CEdit等。。。

shadowWind 2005-10-26 07:30:34
已知一些字符的unicode编码,想把这些字符显示出来。
如:0x00f0 0x014b 0x00e6 0x03b8
谢谢~
...全文
356 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ehobt 2005-10-26
  • 打赏
  • 举报
回复
1:最最重要的:选择对字体和字符集,你所显示的文字一定要包含在选择的字体里面,并且使用的字符集和要显示的文字的字符集的趋于一致,这个在设置font的参数的时候可以设置
2:如果你的程序是基于UNICODE编译的,不需要转化这些字符串,否则,需要将这些字符串转化成相关区域的普通字符串,然后显示,使用WideCharToMultiByte函数即可,其用法可以参照以前的帖子
vcmute 2005-10-26
  • 打赏
  • 举报
回复
USES_CONVERSION;
SetWindowText(W2A(pbUnicode));
vcmute 2005-10-26
  • 打赏
  • 举报
回复
或者使用W2B转化,即WideCharToMultiByte
dspmx 2005-10-26
  • 打赏
  • 举报
回复
设置成unicode工程就可以了。
ww51xh 2005-10-26
  • 打赏
  • 举报
回复
MultiByteToWideChar
The MultiByteToWideChar function maps a character string to a wide-character (Unicode) string. The character string mapped by this function is not necessarily from a multibyte character set.

int MultiByteToWideChar(
UINT CodePage, // code page
DWORD dwFlags, // character-type options
LPCSTR lpMultiByteStr, // string to map
int cbMultiByte, // number of bytes in string
LPWSTR lpWideCharStr, // wide-character buffer
int cchWideChar // size of buffer
);


用这个把其转换过来
LoveTide 2005-10-26
  • 打赏
  • 举报
回复
WCHAR tempUnicodeString[256]=L"unicode字符";
SetDlgItemTextW (资源号, tempUnicodeString);

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧