sinat_17144053
sinat_17144053
采纳率71.4%
2015-06-06 12:30 阅读 1.4k
已采纳

新手用MFC求教,在咋们CSDN上搜到一个程序刚好我要用,收拾了一堆出错后剩下这个求教。

{WM_NULL,"WM_NULL"},
{WM_CREATE,"WM_CREATE"},
{WM_DESTROY,"WM_DESTROY"},
{WM_MOVE,"WM_MOVE"},
{WM_SIZE,"WM_SIZE"},
{WM_ACTIVATE,"WM_ACTIVATE"},
{WM_SETFOCUS,"WM_SETFOCUS"},
{WM_KILLFOCUS,"WM_KILLFOCUS"},
{WM_ENABLE,"WM_ENABLE"},
{WM_SETREDRAW,"WM_SETREDRAW"},
{WM_SETTEXT,"WM_SETTEXT"},
{WM_GETTEXT,"WM_GETTEXT"},
{WM_GETTEXTLENGTH,"WM_GETTEXTLENGTH"},
{WM_PAINT,"WM_PAINT"},
{WM_CLOSE,"WM_CLOSE"},
{WM_QUERYENDSESSION,"WM_QUERYENDSESSION"},
{WM_QUIT,"WM_QUIT"},
后半部分全是波浪线
出错提示:
1>e:\pjb\messagetip\messagetip\stdafx.h(71): error C2440: “初始化”: 无法从“const char [8]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>e:\pjb\messagetip\messagetip\stdafx.h(72): error C2440: “初始化”: 无法从“const char [10]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>e:\pjb\messagetip\messagetip\stdafx.h(73): error C2440: “初始化”: 无法从“const char [11]”转换为“LPCTSTR”
1> 与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换
1>e:\pjb\messagetip\messagetip\stdafx.h(74): error C2440: “初始化”: 无法从“const char [8]”转换为“LPCTSTR”

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • 已采纳
    thiefInSdu thiefInSdu 2015-06-06 12:56

    也可以在工程属性里禁用unicode

    点赞 评论 复制链接分享
  • thiefInSdu thiefInSdu 2015-06-06 12:55

    类型不符,LPCTSTR是指宽字符串,用字符串初始化时应强制转换,一般用_T(),如CString str=_T("hello world");

    点赞 评论 复制链接分享
  • 91program 91program 2015-06-06 13:15

    先看结构体的定义吧,保证定义与变量赋值一致。如果是unicode,也字符串需要使用TEXT,_T或者L

    点赞 评论 复制链接分享
  • tabe123 霓为衣兮风为裳 2015-06-06 16:18

    这个里面所有的字符串都要用_T()包起来 才能兼容宽字符及 mfc过时了 建议换吧

    点赞 评论 复制链接分享

相关推荐