我的错误如下:
Skipping... (no relevant changes detected)
MainFrm.cpp
Linking...
messageView.obj : error LNK2001: unresolved external symbol "protected: void __thiscall CMessageView::OnMyMessage(unsigned int,long)" (?OnMyMessage@CMessageView@@IAEXIJ@Z)
Debug/message.exe : fatal error LNK1120: 1 unresolved externals
下面是我改动的代码注意我添加了这样一个函数  void OnMyMessage(WPARAM wParam,LPARAM lParam);
class CMainFrame : public CFrameWnd
{
.....//省掉部分代码
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMainFrame();
    void OnMyMessage(WPARAM wParam,LPARAM lParam);
......
}
在另外一个文件里,我对这个函数进行定义,注意我包含了头文件#include "MainFrm.h "
void CMainFrame::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
   
}为的是实现自定义消息映射
ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)可以报错了55555555

解决方案 »

  1.   

    void OnMyMessage(WPARAM wParam,LPARAM lParam)
    改成
    LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam)
      

  2.   

    你仔细看看这个:
    错误提示说CMessageView::OnMyMessage(unsigned int,long)未定义
    就是说系统没找到CMessageView类里的OnMyMessage函数,而你的函数却是定义在了CMainFrame 里,当然找不到了你的ON_MESSAGE映射是不是放在了CMessageView里了?要么把ON_MESSAGE映射放在CMainFrame 里,要么把函数声明和定义放到CMessageView里
      

  3.   

    void __thiscall CMessageView::OnMyMessage(unsigned int,long)" (?
    还是CMainFrame
      

  4.   

    CMessageView里面也有OnMyMessage?
      

  5.   

    messageView.cpp里的问题。贴错了。
      

  6.   

    函数实现的位置错了,而且自定义的消息返回值为 LRESULT
      

  7.   

    VS2005及其以上版本,自定义消息的返回值为LRESULT
      

  8.   

    class CMainFrame : public CFrameWnd
    {
    .....//省掉部分代码 
    public:// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainFrame)
    virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    //}}AFX_VIRTUAL// Implementation
    public:
    virtual ~CMainFrame();
    afx_msg LRESULT OnMyMessage(WPARAM wParam,LPARAM lParam); //修改......
    }
    在另外一个文件里,我对这个函数进行定义,注意我包含了头文件#include "MainFrm.h "
    LRESULT CMainFrame::OnMyMessage(WPARAM wParam,LPARAM lParam) //修改{
        
    }为的是实现自定义消息映射
    ON_MESSAGE(WM_MY_MESSAGE,OnMyMessage)
      

  9.   

    你申明的时候,应用:
    afx_msg void OnMyMessage(WPARAM wParam,LPARAM lParam);
      

  10.   


    Messages是我的工程名字 .....