我在自定义消息时出现了一个错误
E:\Source Code\UserServer\UserServerDlg.cpp(57) : error C2440: 'type cast' : cannot convert from 'int *' to 'long (__thiscall CWnd::*)(unsigned int,long)'
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)//“问题语句”
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
我是按照网上的文档做的,不知为何会出这个问题?那位大侠能帮帮我,或者给我一个能调通的步骤!感谢感谢!
E:\Source Code\UserServer\UserServerDlg.cpp(57) : error C2440: 'type cast' : cannot convert from 'int *' to 'long (__thiscall CWnd::*)(unsigned int,long)'
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)//“问题语句”
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
我是按照网上的文档做的,不知为何会出这个问题?那位大侠能帮帮我,或者给我一个能调通的步骤!感谢感谢!
解决方案 »
- IOCP 多线程 接收 问题
- ShowWindow() 刷新太慢怎么办?
- 怎样获得本机浏览器类型串(用来初始化HTTP请求头第5行,如: ,"User-Agent:Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)");
- 鼠标穿透功能怎么实现?
- 新手问题:如何判断ClistCtrl中那一行别选中了?
- 关于API的编译
- 网络方面的编程现在大家都在用什么工具?
- C++中,有没有全局变量,可以被项目中所有的类共用?
- ADO动态创建Access表时表名限制问题
- MFC,三维,谁能回答我,我要疯了!!!!!!
- c++的朋友看过来!看一下这段代码!
- 请问如何实现遍历文件目录?
//{{AFX_MSG(...)
...
afx_msg LRESULT OnTcMessage(WPARAM wParam, LPARAM lParam);
...
//}}AFX_MSG然后还要在UserServerDlg.CPP中给出
LRESULT CUserServerDlg::OnTcMessage(WPARAM wParam, LPARAM lParam)
{
...
}
//}}AFX_MSG_MAP
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)//“问题语句”
要放到外面,不要在里面头文件也一样
E:\Source Code\UserServer\UserServerDlg.cpp(59) : error C2440: 'type cast' : cannot convert from 'int *' to 'long (__thiscall CWnd::*)(unsigned int,long)'
There is no context in which this conversion is possible
E:\Source Code\UserServer\UserServerDlg.cpp(59) : error C2065: 'OnTcMessage' : undeclared identifier
出现了两个错误!谁能给我写一个自定义消息的步骤?
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)//
你把它放在了CAboutDlg里面了。
放错地方了,
//----------------------
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)//“问题语句”
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//----------------------
CAboutDlg??我猜应该是另外的类里去影射吧?
应放在.cpp文件中。
现在已经解决,谢谢大家
ON_MESSAGE(WM_TC_MESSAGE,OnTcMessage)你把它放到UserServerDlg.cpp中的影射的地方