Order of Message Map Entries - Does It Matter?

Tech-Archive recommends: Fix windows errors by optimizing your registry



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?



.



Relevant Pages