I'm currently reading this book, and I've understood everything up to chapter 7 and the dynamic menus. What I can't understand (or what the book doesn't explain well enough) is the part about the command ranges and OnCommandRange functions..
If anyone else has this book, they might know the section I'm talking about, if not, I'll explain it a little.
The book says to define ON_COMMAND_RANGE(0x9000, 0xDFFF, OnCommandRange) macro between the boundaries of a BEGIN_MESSAGE_MAP() and END_MESSAGE_MAP() pair.
Then we create the OnCommandRange function, like so:
void CMainFrame::OnCommandRange(UINT id)
case ID_DYNA_COMMAND_1: ...
case ID_DYNA_COMMAND_2: ...
This is where I go lost.
What do I put in the case statements? How do I create a dynamic menu? Where exactly am I supposed to put these BEGIN_MESSAGE_MAP() and END_MESSAGE_MAP() pairs?
Can someone give me an example on how to add a menu item at runtime? I can make the program add another menu item with the ID of ID_EDIT_PASTE or another existing ID, but whenever I try to use my own ID, I get an undeclared identifier error..
Thanks in advance.