title: Disabling customization only on MFC menu bar
body: <p>When using the MFC feature pack in VS2010, is it possible to disable the customization feature on the CMFCMenuBar but leave it enabled on the toolbars?  We don't want users dragging menus around but they're free to change the toolbars.</p>
  
  <p>We disabled saving the state of the CMFCMenuBar into the registry on exit but the menus could still be moved around or removed during runtime.</p>
  
  <p><strong>Update</strong>:
  Following xMRi's answer, I set m_bDisableCustomize to TRUE in a derived menu class's constructor.  I noticed there was a redrawing issue where clicking on the menu during the customization would draw black boxes all over the menus.  That led me to <a href="http://www.bcgsoft.com/cgi-bin/forum/topic.asp?TOPIC_ID=2643" rel="nofollow">http://www.bcgsoft.com/cgi-bin/forum/topic.asp?TOPIC_ID=2643</a></p>
  
  <p>I didn't want to modify the MFC source code so I handled the message instead:</p>
  
  <pre><code>//{{AFX_MSG_MAP(CMyMFCMenuBar)
  BEGIN_MESSAGE_MAP(CMyMFCMenuBar, CMFCMenuBar)
      ON_WM_LBUTTONDOWN()
      ON_WM_CONTEXTMENU()
  END_MESSAGE_MAP()
  //}}AFX_MSG_MAP
  
  void CMyMFCMenuBar::OnLButtonDown(UINT nFlags, CPoint point)
  {
      CMFCMenuBar::OnLButtonDown(nFlags, point);
      Invalidate();
  }
  
  void CMyMFCMenuBar::OnContextMenu(CWnd* pWnd, CPoint pos)
  {
      if (IsCustomizeMode())
          return;
      CMFCMenuBar::OnContextMenu(pWnd, pos);
  }
  </code></pre>
  
  <p>and that seems to fix the redrawing issue.  Please let me know if there's a better way to fix the redrawing issue.</p>