关于MFC消息响应函数的问题

sophiayhc 2008-05-27 02:34:55
我在CPrintFrame里定义了三个消息响应,如:
#define WM_MY_PRINT (WM_USER+1003)
#define WM_BEGIN_PRINTING (WM_USER+1004)
#define WM_END_PRINTING (WM_USER+1005)

现在在CReportSet.h定义:
protected:
HICON m_hIcon;
//{{AFX_MSG(CReportSet)
//}}AFX_MSG
LRESULT OnBeginPrinting(WPARAM wParam,LPARAM lParam);
LRESULT OnEndPrinting(WPARAM wParam,LPARAM lParam);
LRESULT OnMyPrint(WPARAM wParam,LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
可是在CReportSet.CPP消息宏里头加入时,
BEGIN_MESSAGE_MAP(CReportSet, CDialog)
//{{AFX_MSG_MAP(CReportSet)
……
//}}AFX_MSG_MAP
ON_MESSAGE(WM_BEGIN_PRINTING,OnBeginPrinting)
ON_MESSAGE(WM_END_PRINTING,OnEndPrinting)
ON_MESSAGE(WM_MY_PRINT,OnMyPrint)
END_MESSAGE_MAP()

错误如下: unresolved external symbol "protected: long __thiscall CReportSet::OnMyPrint(unsigned int,long)" (?OnMyPrint@CReportSet@@IAEJIJ@Z),请问怎么办?
...全文
184 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bitxinhai 2008-05-27
  • 打赏
  • 举报
回复
对应的头文件添加消息函数声明:
afx_msg void OnMyPrint();
cnzdgs 2008-05-27
  • 打赏
  • 举报
回复
先写个空壳顶着。
快乐鹦鹉 2008-05-27
  • 打赏
  • 举报
回复
那赶紧写吧。可以先写空函数体。编译就没有问题了
sophiayhc 2008-05-27
  • 打赏
  • 举报
回复
函数我还没写呢
cnzdgs 2008-05-27
  • 打赏
  • 举报
回复
看看OnMyPrint函数体前面是不是忘了加CReportSet::。
快乐鹦鹉 2008-05-27
  • 打赏
  • 举报
回复
OnMyPrint的函数体你写了么???

15,979

社区成员

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

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