error C2440: 'static_cast' LRESULT LRESULT错误

这是以前在网上搜到得一段对话

问1:为什么编译的时候在消息映射那里出错了:   
  error   C2440:   “static_cast”:   无法从“void   (__thiscall   CMainFrame::*   )(void)”转换为“LRESULT   (__thiscall   CWnd::*   )(WPARAM,LPARAM)”                   在匹配目标类型的范围内没有具有该名称的函数   
答:There   is   a   bug   in   6.0   compiler   that   permits   you   to   use   afx_msg   void   OnProgress();.   You   need   to   change   your   function   to   LRESULT   OnProgress(WPARAM,LPARAM).

问2:为什么MFC在其他的消息或者事件响应里面却能这样写呢?它不也都是用的void来申明的?
答:Some   message   handler   functions   such   as   the   wizard   generated   WM_CREATE   handler   are   virtual   functions   derived   from   default   MFC   implementations.   Check   out   MFC   source   code   to   see   how   MFC   handle   these   messages.
It   is   safe   if   you   don't   use   the   result   and   the   parameter   of   the   message   at   all.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值