一个简单的MessageBox问题

djwinter 2006-07-16 04:39:33
MessageBox("123");在vc6中编译了好好的
但是到了vc2005中就报错
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [3]' to 'LPCTSTR'Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

MessageBox(LPCTSTR("123"));编译能够通过,但是乱码。
...全文
326 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
VirtualDesktop 2006-07-29
  • 打赏
  • 举报
回复
MessageBox(_T("123"));
vc2005对类型检查严格了很多
折腾_苏州 2006-07-28
  • 打赏
  • 举报
回复
MessageBox(__T("123"));呢??
怎么会不能识别??
QIN_HULI 2006-07-28
  • 打赏
  • 举报
回复
为什么不识别L 和_T

怎么回事啊]
QIN_HULI 2006-07-28
  • 打赏
  • 举报
回复
2005默认UNICODE编码。
MessageBox(L("123"));


MessageBox(_T("123"));
用_T()宏,ANSI还是Unicode都可以正确编译。


大哥们可以给我解释下马
不懂
guojh021 2006-07-17
  • 打赏
  • 举报
回复
MessageBox::Show("123");
thinboyxp 2006-07-17
  • 打赏
  • 举报
回复
MessageBox(_T("123"));
用_T()宏,ANSI还是Unicode都可以正确编译。
化外之民 2006-07-17
  • 打赏
  • 举报
回复
2005默认UNICODE编码。
MessageBox(L("123"));

7,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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