One Handler for Multiple Elements

Have you ever wanted to handle a group of buttons (or other WM_COMMAND messages with one routine? It's easy. Just manually insert an ON_COMMAND_RANGE macro into your message map. Be sure to do it after the Class Wizard comments. For example:
     BEGIN_MESSAGE_MAP(CDemoView, CView)
        //{{AFX_MSG_MAP(CDemoView)
        ON_COMMAND(ID_FILE_NEW, OnFileNew)
        ON_COMMAND(ID_FILE_SAVE, OnFileSave)
        //}}AFX_MSG_MAP
        ON_COMMAND_RANGE(9000,9999,OnCmdGroup)
     END_MESSAGE_MAP()

This message map will route all command ID's from 9000-9999 to the OnCmdGroup function. This function is a bit different from an ordinary command handler:

    void CCol20View::OnStation(UINT id)
        {
        // do your thing for command id
        }

As you might guess, the id parameter is the command ID that triggered the routine.