Re: Order of Message Map Entries - Does It Matter?
- From: "Cyde Weys" <cyde@xxxxxxx>
- Date: 10 Aug 2005 10:37:54 -0700
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.
.
- Follow-Ups:
- Re: Order of Message Map Entries - Does It Matter?
- From: George B
- Re: Order of Message Map Entries - Does It Matter?
- References:
- Order of Message Map Entries - Does It Matter?
- From: George B
- Order of Message Map Entries - Does It Matter?
- Prev by Date: Re: How to thread a progress bar in a separate dialog?
- Next by Date: Re: Fill a CListCtrl
- Previous by thread: Order of Message Map Entries - Does It Matter?
- Next by thread: Re: Order of Message Map Entries - Does It Matter?
- Index(es):
Relevant Pages
|