title: how to correctly send CMFCMenuButton selected ID to the message map?
body: <p>firstly let me describe what I have:<br>
  <strong>scenario:</strong> <code>CMFCMenuButton</code>, loaded with a <code>CMenu</code>, in a dialog <br /><strong>test:</strong> click on an item of the menu<br /><strong>result:</strong> the message map will get the ID of the <code>CMFCMenuButton</code> and not the ID of the menu
  <br /><strong>how to get the actual menu ID clicked:</strong> use <code>CMFCMenuButton::m_nMenuResult</code><br /><br />The idea is that I want to have menu items and buttons in this dialog, and there would be buttons that share IDs with the menu items.<br /><br />So in the handler that I've created for the menu button I can get that <code>m_nMenuResult</code> and send it to the dialog or do whatever I want, but that doesn't seem to be how the <code>CMFCMenuButton</code> should work. What is the correct way of doing it?
  <br /><br /><h2>Code</h2>Here follows an example on how you can reproduce this.
  <br />I've used <code>ON_COMMAND_RANGE</code> also with <code>IDC_MFCMENUBUTTON1</code> just to reuse the code for the OnMenu function</p>
  
  <pre class="lang-c++ prettyprint-override"><code>void CRepositionDlg::DoDataExchange(CDataExchange* pDX)
  {
      CDialog::DoDataExchange(pDX);
      DDX_Control(pDX, IDC_MFCMENUBUTTON1, m_cmfcMenuButton);
  }
  
  
  BEGIN_MESSAGE_MAP(CRepositionDlg, CDialog)
      ON_COMMAND_RANGE(IDC_MFCMENUBUTTON1,IDC_MFCMENUBUTTON1,OnMenu)
  
      ON_COMMAND_RANGE(IDC_MENU1, IDC_MENU11, OnMenu)
  END_MESSAGE_MAP()
  
  
  // CRepositionDlg message handlers
  
  afx_msg void CRepositionDlg::OnMenu(UINT nID)
  {
      CString csMessage;
      csMessage.Format(L"OnMenu(%d)",nID);
      AfxMessageBox(csMessage);
      if(nID == IDC_MFCMENUBUTTON1)
      {
          OnMenu(m_cmfcMenuButton.m_nMenuResult);
      }
  }
  
  
  BOOL CRepositionDlg::OnInitDialog()
  {
      CDialog::OnInitDialog();
  
      // TODO:  Add extra initialization here
  
      CMenu* pMenu = new CMenu;
      pMenu-&gt;CreatePopupMenu();
      for(int i = IDC_MENU1; i &lt;= IDC_MENU11; i++)
      {
          CString csMenu;
          csMenu.Format(L"menu %d",i);
          pMenu-&gt;AppendMenuW(MF_STRING,i,csMenu);
      }
      m_cmfcMenuButton.m_hMenu = pMenu-&gt;GetSafeHmenu();
      return TRUE;  // return TRUE unless you set the focus to a control
      // EXCEPTION: OCX Property Pages should return FALSE
  }
  </code></pre>