Re: Order of Message Map Entries - Does It Matter?




George B wrote:
> Using VC6, my SDI app was working properly until I decided to replace
> individual message handlers by a handler for a range. Using Class Wizard, I
> deleted the individual message handlers and then added my own entry to the
> message map following the Class Wizard entries. Is there a requirement that
> the message map entries be in numerical order? What's happening is that the
> handlers for my last two individual ID's are not being called, but control
> is being passed to the handler for the range.
>
> My message map looks something like the following:
>
> BEGIN_MESSAGE_MAP(CMyDoc, CDocument)
> //{{AFX_MSG_MAP(CMyDoc)
> ON_COMMAND(ID_MY1, OnMy1)
> ON_COMMAND(ID_MY2, OnMy2)
> ON_COMMAND(ID_MY6, OnMy6)
> ON_COMMAND(ID_MY7, OnMy7)
> //}}AFX_MSG_MAP
> ON_COMMAND_RANGE(ID_MY3,ID_MY5,OnMy3to5)
> END_MESSAGE_MAP()
>
> The ID's My1-My7 were created in that order by Class Wizard, and I'm
> attempting to have a range handler for 3-5. When I execute the app,
> messages 6 and 7 both appear to be diverted to OnMy3to5.
>
> Any ideas?

ID_MY6 and ID_MY7 should be called by their respective handlers, not
the range ID_MY3 to ID_MY5. I'm thinking that your IDs are not in
order by number as you would think they are by name. Open up
resource.h and make sure they are sequential in the correct sequence.

.



Relevant Pages

  • Order of Message Map Entries - Does It Matter?
    ... my SDI app was working properly until I decided to replace ... individual message handlers by a handler for a range. ... message map following the Class Wizard entries. ...
    (microsoft.public.vc.mfc)
  • Re: Order of Message Map Entries - Does It Matter?
    ... >individual message handlers by a handler for a range. ... >message map following the Class Wizard entries. ...
    (microsoft.public.vc.mfc)
  • Re: Order of Message Map Entries - Does It Matter?
    ... my SDI app was working properly until I decided to replace ... >> individual message handlers by a handler for a range. ... >> message map following the Class Wizard entries. ...
    (microsoft.public.vc.mfc)
  • Re: dynamic menus
    ... but they will all have basic machine control ... But can the message map in a view or doc or mainframe be mapped to ... > The menu belongs to the CMainFrame. ... > management and message handlers also belong in CMainFrame. ...
    (microsoft.public.vc.mfc)
  • Re: Menu on Dialog
    ... > For couple of this menus handlers are implemented as UPDATE_COMMAND_UI ... > Code inside these handlers work only when these handlers implemented ... you use an SDI app instead? ...
    (microsoft.public.vc.mfc)