title: VS2010 C++ MFC Hide Toolbar
body: <p>I'm having trouble understanding just how the View Menu turns off the Standard Toolbar in terms of code.</p>
  
  <p>If I understand correctly, the standard toolbar is defined in the .rc file as follows:</p>
  
  <pre><code>IDR_MAINFRAME TOOLBAR 16, 15
  BEGIN
      BUTTON      ID_FILE_NEW
      BUTTON      ID_FILE_OPEN
      BUTTON      ID_FILE_SAVE
      SEPARATOR
      BUTTON      ID_EDIT_CUT
      BUTTON      ID_EDIT_COPY
      BUTTON      ID_EDIT_PASTE
      SEPARATOR
      BUTTON      ID_FILE_PRINT
      BUTTON      ID_APP_ABOUT
  END
  </code></pre>
  
  <p>Similarly the View Menu, which allows you to turn the Standard Toolbar on and off is defined as follows:</p>
  
  <pre><code>IDR_MAINFRAME MENU
  BEGIN
      POPUP "&amp;File"
      BEGIN
          MENUITEM "&amp;New\tCtrl+N",                ID_FILE_NEW
          MENUITEM "&amp;Open...\tCtrl+O",            ID_FILE_OPEN
          MENUITEM "&amp;Close",                      ID_FILE_CLOSE
          MENUITEM SEPARATOR
          MENUITEM "P&amp;rint Setup...",             ID_FILE_PRINT_SETUP
          MENUITEM SEPARATOR
          MENUITEM "Recent File",                 ID_FILE_MRU_FILE1,GRAYED
          MENUITEM SEPARATOR
          MENUITEM "E&amp;xit",                       ID_APP_EXIT
      END
      POPUP "&amp;View"
      BEGIN
          POPUP "&amp;Toolbars and Docking Windows"
          BEGIN
              MENUITEM "&lt;placeholder&gt;",           ID_VIEW_TOOLBAR
          END
          MENUITEM "&amp;Status Bar",                 ID_VIEW_STATUS_BAR
          POPUP "&amp;Application Look"
          BEGIN
              MENUITEM "Windows &amp;2000",           ID_VIEW_APPLOOK_WIN_2000
              MENUITEM "Office &amp;XP",              ID_VIEW_APPLOOK_OFF_XP
              MENUITEM "&amp;Windows XP",             ID_VIEW_APPLOOK_WIN_XP
              MENUITEM "Office 200&amp;3",            ID_VIEW_APPLOOK_OFF_2003
              MENUITEM "Visual Studio 200&amp;5",     ID_VIEW_APPLOOK_VS_2005
              MENUITEM "Visual Studio 200&amp;8",     ID_VIEW_APPLOOK_VS_2008
              POPUP "Office 200&amp;7"
              BEGIN
                  MENUITEM "&amp;Blue Style",         ID_VIEW_APPLOOK_OFF_2007_BLUE
                  MENUITEM "B&amp;lack Style",        ID_VIEW_APPLOOK_OFF_2007_BLACK
                  MENUITEM "&amp;Silver Style",       ID_VIEW_APPLOOK_OFF_2007_SILVER
                  MENUITEM "&amp;Aqua Style",         ID_VIEW_APPLOOK_OFF_2007_AQUA
              END
          END
      END
      POPUP "&amp;Help"
      BEGIN
          MENUITEM "&amp;About Emergence...",          ID_APP_ABOUT
      END
  END
  </code></pre>
  
  <p>Now my reasoning is this....in order for the MENUITEM that allows you to toggle the Standard Toolbar on and off to work, ID_VIEW_TOOLBAR must somehow reference the toolbar definition itself. I have searched the entire project and nowhere can I find where ID_VIEW_TOOLBAR is associated with the Standard Toolbar definition. Surely there must be some relationship linking ID_VIEW_TOOLBAR to the definition of IDR_MAINFRAME TOOLBAR 16, 15 in order to toggle it on and off?? </p>
  
  <p>If not, could you kindly explain how ID_VIEW_TOOLBAR turns off the Standard Toolbar?</p>
  
  <p>Thanks for your time. </p>