Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. message reflection

message reflection

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++regex
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prateekkathuria
    wrote on last edited by
    #1

    I am using message reflection in myButton class so what i have in the message map is as below: BEGIN_MESSAGE_MAP(myButton, CButton) ON_CONTROL_REFLECT(BN_CLICKED, onButtonClick) END_MESSAGE_MAP() the prototype for onButtonClick() is afx_msg void onButtonClick() and this works well. But i do want the parent as well to be notified so as mentioned in the MFC doc i modified the onButtonClick to return BOOL so it is then afx_msg BOOL onButtonClick() But this gives a compile time error : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall aegis::myButton::* )(void)' to 'AFX_PMSG' None of the functions with this name in scope match the target type. Any suggestions or is it a yet another bug in mfc. thanks

    P 1 Reply Last reply
    0
    • P prateekkathuria

      I am using message reflection in myButton class so what i have in the message map is as below: BEGIN_MESSAGE_MAP(myButton, CButton) ON_CONTROL_REFLECT(BN_CLICKED, onButtonClick) END_MESSAGE_MAP() the prototype for onButtonClick() is afx_msg void onButtonClick() and this works well. But i do want the parent as well to be notified so as mentioned in the MFC doc i modified the onButtonClick to return BOOL so it is then afx_msg BOOL onButtonClick() But this gives a compile time error : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall aegis::myButton::* )(void)' to 'AFX_PMSG' None of the functions with this name in scope match the target type. Any suggestions or is it a yet another bug in mfc. thanks

      P Offline
      P Offline
      prateekkathuria
      wrote on last edited by
      #2

      got rid of the compilation error need to use ON_COMMAND_REFLECT_EX. So now my code compiles and runs but the handler of the parent is not invoked why?? although i do have an onButtonClick in the parent.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups