CMFCMenuBar Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCMenuBar Class.

A menu bar that implements docking.

class CMFCMenuBar : public CMFCToolbar  

Public Methods

NameDescription
CMFCMenuBar::AdjustLocations(Overrides CMFCToolBar::AdjustLocations.)
CMFCMenuBar::AllowChangeTextLabelsSpecifies whether text labels can be shown under images on the toolbar buttons. (Overrides CMFCToolBar::AllowChangeTextLabels.)
CMFCMenuBar::AllowShowOnPaneMenu(Overrides CPane::AllowShowOnPaneMenu.)
CMFCMenuBar::CalcFixedLayoutCalculates the horizontal size of the toolbar. (Overrides CMFCToolBar::CalcFixedLayout.)
CMFCMenuBar::CalcLayout(Overrides CMFCToolBar::CalcLayout.)
CMFCMenuBar::CalcMaxButtonHeightCalculates the maximum height of buttons in the toolbar. (Overrides CMFCToolBar::CalcMaxButtonHeight.)
CMFCMenuBar::CanBeClosedSpecifies whether a user can close the toolbar. (Overrides CMFCToolBar::CanBeClosed.)
CMFCMenuBar::CanBeRestoredDetermines whether the system can restore a toolbar to its original state after customization. (Overrides CMFCToolBar::CanBeRestored.)
CMFCMenuBar::CreateCreates a menu control and attaches it to a CMFCMenuBar object.
CMFCMenuBar::CreateExCreates a CMFCMenuBar object with additional style options.
CMFCMenuBar::CreateFromMenuInitializes a CMFCMenuBar object. Accepts a HMENU parameter that acts as a template for a populated CMFCMenuBar.
CMFCMenuBar::EnableHelpComboboxEnables a Help combo box that is located on the right side of the menu bar.
CMFCMenuBar::EnableMenuShadowsSpecifies whether to display shadows for pop-up menus.
CMFCMenuBar::GetAvailableExpandSize(Overrides CPane::GetAvailableExpandSize.)
CMFCMenuBar::GetColumnWidthReturns the width of the toolbar buttons. (Overrides CMFCToolBar::GetColumnWidth.)
CMFCMenuBar::GetDefaultMenuReturns a handle to the original menu in the resource file.
CMFCMenuBar::GetDefaultMenuResIdReturns the resource identifier for the original menu in the resource file.
CMFCMenuBar::GetFloatPopupDirection
CMFCMenuBar::GetForceDownArrows
CMFCMenuBar::GetHelpComboboxReturns a pointer to the Help combo box.
CMFCMenuBar::GetHMenuReturns the handle to the menu that is attached to the CMFCMenuBar object.
CMFCMenuBar::GetMenuFontReturns the current global font for menu objects.
CMFCMenuBar::GetMenuItemReturns the toolbar button associated with the provided item index.
CMFCMenuBar::GetRowHeightReturns the height of toolbar buttons. (Overrides CMFCToolBar::GetRowHeight.)
CMFCMenuBar::GetSystemButton
CMFCMenuBar::GetSystemButtonsCount
CMFCMenuBar::GetSystemMenu
CMFCMenuBar::HighlightDisabledItemsIndicates whether disabled menu items are highlighted.
CMFCMenuBar::IsButtonExtraSizeAvailableDetermines whether the toolbar can display buttons that have extended borders. (Overrides CMFCToolBar::IsButtonExtraSizeAvailable.)
CMFCMenuBar::IsHighlightDisabledItemsIndicates whether disabled items are highlighted.
CMFCMenuBar::IsMenuShadowsIndicates whether shadows are drawn for pop-up menus.
CMFCMenuBar::IsRecentlyUsedMenusIndicates whether recently used menu commands are displayed on the menu bar.
CMFCMenuBar::IsShowAllCommandsIndicates whether pop-up menus display all commands.
CMFCMenuBar::IsShowAllCommandsDelayIndicates whether menus display all the commands after a short delay.
CMFCMenuBar::LoadStateLoads the state of the CMFCMenuBar object from the registry.
CMFCMenuBar::OnChangeHotCalled by the framework when a user selects a button on the toolbar. (Overrides CMFCToolBar::OnChangeHot.)
CMFCMenuBar::OnDefaultMenuLoadedCalled by the framework when a frame window loads the default menu from the resource file.
CMFCMenuBar::OnSendCommand(Overrides CMFCToolBar::OnSendCommand.)
CMFCMenuBar::OnSetDefaultButtonTextCalled by the framework when a menu is in customization mode and the user changes a menu item's text.
CMFCMenuBar::OnToolHitTest(Overrides CMFCToolBar::OnToolHitTest.)
CMFCMenuBar::PreTranslateMessage(Overrides CMFCToolBar::PreTranslateMessage.)
CMFCMenuBar::RestoreOriginalstateCalled by the framework when a menu is in customization mode and the user selects Reset for a menu bar.
CMFCMenuBar::SaveStateSaves the state of the CMFCMenuBar object to the registry.
CMFCMenuBar::SetDefaultMenuResIdSets the original menu in the resource file.
CMFCMenuBar::SetForceDownArrows
CMFCMenuBar::SetMaximizeModeCalled by the framework when an MDI child window changes its display mode. If the MDI child window is newly maximized or is no longer maximized, this method updates the menu bar.
CMFCMenuBar::SetMenuButtonRTCSets the runtime class information that is generated when the user dynamically creates menu buttons.
CMFCMenuBar::SetMenuFontSets the font for all menus in the application.
CMFCMenuBar::SetRecentlyUsedMenusSpecifies whether a menu bar displays recently used menu commands.
CMFCMenuBar::SetShowAllCommandsSpecifies whether the menu bar shows all commands.

The CMFCMenuBar class is a menu bar that implements docking functionality. It resembles a toolbar, although it cannot be closed - it is always displayed.

CMFCMenuBar supports the option of displaying recently used menu item objects. If this option is enabled, the CMFCMenuBar displays only a subset of the available commands on first viewing. Thereafter, recently used commands are displayed together with the original subset of commands. In addition, the user can always expand the menu to view all available commands. Thus, each available command is configured to display constantly, or to display only if it has been recently selected.

To use a CMFCMenuBar object, embed it in the main window frame object. When processing the WM_CREATE message, call CMFCMenuBar::Create or CMFCMenuBar::CreateEx. Regardless of which create function you use, pass in a pointer to the main frame window. Then enable docking by calling CFrameWndEx::EnableDocking. Dock this menu by calling CFrameWndEx::DockPane.

The following example demonstrates how to use various methods in the CMFCMenuBar class. The example shows how to set the style of the pane, enable the customize button, enable a Help box, enable shadows for pop-up menus, and update the menu bar. This code snippet is part of the IE Demo sample.

	CMFCMenuBar	m_wndMenuBar;

	m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC);
	m_wndMenuBar.EnableCustomizeButton (TRUE, -1, _T(""));
	// first parameter is the command ID for the button of the Help combo box
	// third parameter is the width of the button for the combo box in pixels.
	m_wndMenuBar.EnableHelpCombobox(1,_T("enter text here"),30);
	m_wndMenuBar.EnableMenuShadows();
	m_wndMenuBar.SetMaximizeMode(true);

CObject

CCmdTarget

CWnd

CBasePane

CPane

CMFCBaseToolBar

CMFCToolBar

CMFCMenuBar

Header: afxmenubar.h

Adjusts the positions of the menu items on the menu bar.

virtual void AdjustLocations();

Remarks

Determines whether text labels are allowed under images in the menu bar.

virtual BOOL AllowChangeTextLabels() const;  

Return Value

Returns TRUE if the user can choose to show text labels under images.

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL AllowShowOnPaneMenu() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual CSize CalcFixedLayout(
    BOOL bStretch,  
    BOOL bHorz);

Parameters

[in] bStretch
[in] bHorz

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual CSize CalcLayout(
    DWORD dwMode,  
    int nLength = -1);

Parameters

[in] dwMode
[in] nLength

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual int CalcMaxButtonHeight();

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL CanBeClosed() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL CanBeRestored() const;  

Return Value

Remarks

Creates a menu control and attaches it to a CMFCMenuBar object.

virtual BOOL Create(
    CWnd* pParentWnd,  
    DWORD dwStyle = AFX_DEFAULT_TOOLBAR_STYLE,  
    UINT nID = AFX_IDW_MENUBAR);

Parameters

[in] pParentWnd
Pointer to the parent window for the new CMFCMenuBar object.

[in] dwStyle
The style of the new menu bar.

[in] nID
The ID for the child window of the menu bar.

Return Value

TRUE if successful; otherwise FALSE.

Remarks

After you construct a CMFCMenuBar object, you must call Create. This method creates the CMFCMenuBar control and attaches it to the CMFCMenuBar object.

For more information about toolbar styles, see CBasePane::SetPaneStyle.

Creates a CMFCMenuBar object with specified extended styles.

virtual BOOL CreateEx(
    CWnd* pParentWnd,  
    DWORD dwCtrlStyle = TBSTYLE_FLAT,  
    DWORD dwStyle = AFX_DEFAULT_TOOLBAR_STYLE,  
    CRect rcBorders = CRect(1,
    1,
    1,
    1),  
    UINT nID =AFX_IDW_MENUBAR);

Parameters

[in] pParentWnd
Pointer to the parent window of the new CMFCMenuBar object.

[in] dwCtrlStyle
Additional styles for the new menu bar.

[in] dwStyle
The main style of the new menu bar.

[in] rcBorders
A CRect parameter that specifies the sizes for the borders of the CMFCMenuBar object.

[in] nID
The ID for the child window of the menu bar.

Return Value

Nonzero if the method is successful; otherwise 0.

Remarks

You should use this function instead of CMFCMenuBar::Create when you want to specify styles in addition to the toolbar style. Some frequently used additional styles are TBSTYLE_TRANSPARENT and CBRS_TOP.

For lists of additional styles, see Toolbar Control and Button Styles, common control styles, and common window styles.

Example

The following example demonstrates how to use the CreateEx method of the CMFCMenuBar class. This code snippet is part of the IE Demo sample.

	CMFCMenuBar	m_wndMenuBar;

	// The this pointer points to CMainFrame class which extends the CFrameWnd class.
	if (!m_wndMenuBar.CreateEx (this, TBSTYLE_TRANSPARENT))
	{
		TRACE0("Failed to create menubar\n");
		return -1;      // fail to create
	}

Initializes a CMFCMenuBar object. This method models the CMFCMenuBar object after a HMENU parameter.

virtual void CreateFromMenu(
    HMENU hMenu,  
    BOOL bDefaultMenu = FALSE,  
    BOOL bForceUpdate = FALSE);

Parameters

[in] hMenu
A handle to a menu resource. CreateFromMenu uses this resource as a template for the CMFCMenuBar.

[in] bDefaultMenu
A Boolean that indicates whether the new menu is the default menu.

[in] bForceUpdate
A Boolean that indicates whether this method forces a menu update.

Remarks

Use this method if you want a menu control to have the same menu items as a menu resource. You call this method after you call either CMFCMenuBar::Create or CMFCMenuBar::CreateEx.

Enables a Help combo box that is located on the right side of the menu bar.

void EnableHelpCombobox(
    UINT uiID,  
    LPCTSTR lpszPrompt = NULL,  
    int nComboBoxWidth = 150);

Parameters

[in] uiID
The command ID for the button of the Help combo box.

[in] lpszPrompt
A string that contains the text that the framework displays in the combo box if it is empty and not active. For example, "Enter the text here".

[in] nComboBoxWidth
The width of the button for the combo box in pixels.

Remarks

The Help combo box resembles the Help combo box in the menu bar of Microsoft Word.

When you call this method with uiID set to 0, this method hides the combo box. Otherwise, this method displays the combo box automatically on the right side of your menu bar. After you call this method, call CMFCMenuBar::GetHelpCombobox to obtain a pointer to the inserted CMFCToolBarComboBoxButton object.

Enables shadows for pop-up menus.

static void EnableMenuShadows(BOOL bEnable = TRUE);

Parameters

[in] bEnable
A Boolean parameter that indicates whether shadows should be enabled for pop-up menus.

Remarks

The algorithm that this method uses is complex and may decrease the performance of your application on slower systems.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual int GetAvailableExpandSize() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual int GetColumnWidth() const;  

Return Value

Remarks

Retrieves a handle to the original menu. The framework loads the original menu from the resource file.

HMENU GetDefaultMenu() const;  

Return Value

A handle to a menu resource.

Remarks

If your application customizes a menu, you can use this method to retrieve a handle to the original menu.

Retrieves the resource identifier for the default menu.

UINT GetDefaultMenuResId() const;  

Return Value

A menu resource identifier.

Remarks

The framework loads the default menu for the CMFCMenuBar object from the resource file.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

int GetFloatPopupDirection(CMFCToolBarMenuButton* pButton);

Parameters

[in] pButton

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

BOOL GetForceDownArrows();

Return Value

Remarks

Returns a pointer to the Help combo box.

CMFCToolBarComboBoxButton* GetHelpCombobox();

Return Value

A pointer to the Help combo box. NULL if the Help combo box is hidden or not enabled.

Remarks

The Help combo box is located on the right side of the menu bar. Call the method CMFCMenuBar::EnableHelpCombobox to enable this combo box.

Retrieves the handle to the menu attached to the CMFCMenuBar object.

HMENU GetHMenu() const;  

Retrieves the current menu font.

static const CFont& GetMenuFont(BOOL bHorz = TRUE);

Parameters

[in] bHorz
A Boolean parameter that specifies whether to return the horizontal or vertical font. TRUE indicates the horizontal font.

Return Value

A pointer to a CFont parameter that contains the current menu bar font.

Remarks

The returned font is a global parameter for the application. Two global fonts are maintained for all CMFCMenuBar objects. These separate fonts are used for horizontal and vertical menu bars.

Retrieves a CMFCToolBarButton object on a menu bar based on the item index.

CMFCToolBarButton* GetMenuItem(int iItem) const;  

Parameters

[in] iItem
The index of the menu item to return.

Return Value

A pointer to the CMFCToolBarButton object that matches the index specified by iItem. NULL if the index is invalid.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual int GetRowHeight() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

CMFCToolBarMenuButtonsButton* GetSystemButton(
    UINT uiBtn,  
    BOOL bByCommand = TRUE) const;  

Parameters

[in] uiBtn
[in] bByCommand

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

int GetSystemButtonsCount() const;  

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

CMFCToolBarSystemMenuButton* GetSystemMenu() const;  

Return Value

Remarks

Controls whether the framework highlights disabled menu items.

static void HighlightDisabledItems(BOOL bHighlight = TRUE);

Parameters

[in] bHighlight
A Boolean parameter that indicates whether the framework highlights unavailable menu items.

Remarks

By default, the framework does not highlight unavailable menu items when the user positions the mouse pointer over them.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL IsButtonExtraSizeAvailable() const;  

Return Value

Remarks

Indicates whether the framework highlights unavailable menu items.

static BOOL IsHighlightDisabledItems();

Return Value

TRUE if unavailable menu items are highlighted; otherwise FALSE.

Remarks

By default, the framework does not highlight unavailable menu items when the user positions the mouse pointer over them. Use the CMFCMenuBar::HighlightDisabledItems method to enable this feature.

Indicates whether the framework draws shadows for pop-up menus.

static BOOL IsMenuShadows();

Return Value

TRUE if the framework draws menu shadows; otherwise FALSE.

Remarks

Use the CMFCMenuBar::EnableMenuShadows method to enable or disable this feature.

Indicates whether recently used menu commands are displayed on the menu bar.

static BOOL IsRecentlyUsedMenus();

Return Value

Nonzero if the CMFCMenuBar object shows recently used menu commands; otherwise 0.

Remarks

Use the function CMFCMenuBar::SetRecentlyUsedMenus to control whether the menu bar shows recently used menu commands.

Indicates whether menus display all commands.

static BOOL IsShowAllCommands();

Return Value

Nonzero if the CMFCMenuBar displays all commands; otherwise 0.

Remarks

A CMFCMenuBar object can be configured to either show all commands or show only a subset of commands. For more information about this feature, see CMFCMenuBar Class.

IsShowAllCommands will tell you how this feature is configured for the CMFCMenuBar object. To control which menu commands are shown, use the methods CMFCMenuBar::SetShowAllCommands and CMFCMenuBar::SetRecentlyUsedMenus.

Indicates whether the CMFCMenuBar object displays all the commands after a short delay.

static BOOL IsShowAllCommandsDelay();

Return Value

Nonzero if the menu bar displays full menus after a short delay; otherwise 0.

Remarks

When you configure a menu bar to display recently used items, the menu bar displays the full menu in one of two ways:

  • Display the full menu after a programmed delay from when the user hovers the cursor over the arrow at the bottom of the menu.

  • Display the full menu after the user clicks the arrow at the bottom of the menu.

By default, all CMFCMenuBar objects use the option to display the full menu after a short delay. This option cannot be changed programmatically in the CMFCMenuBar class. However, a user can change the behavior during toolbar customization by using the Customize dialog box..

Loads the state of the menu bar from the Windows registry.

virtual BOOL LoadState(
    LPCTSTR lpszProfileName=NULL,  
    int nIndex=-1,  
    UINT uiID=(UINT)-1);

Parameters

[in] lpszProfileName
A string that contains the path of a Windows registry key.

[in] nIndex
The control ID for the menu bar.

[in] uiID
A reserved value.

Return Value

TRUE if the method was successful; otherwise FALSE.

Remarks

Use the CMFCMenuBar::SaveState method to save the state of the menu bar to the registry. The saved information includes the menu items, the dock state, and the position of the menu bar.

In most cases your application does not call LoadState. The framework calls this method when it initializes the workspace.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual void OnChangeHot(int iHot);

Parameters

[in] iHot

Remarks

The framework calls this method when it loads the menu resource from the resource file.

virtual void OnDefaultMenuLoaded(HMENU hMenu);

Parameters

[in] hMenu
The handle for the menu attached to the CMFCMenuBar object.

Remarks

The default implementation of this function does nothing. Override this function to execute custom code after the framework loads a menu resource from the resource file.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL OnSendCommand(const CMFCToolBarButton* pButton);

Parameters

[in] pButton

Return Value

Remarks

The framework calls this method when the user changes the text of an item on the menu bar.

virtual BOOL OnSetDefaultButtonText(CMFCToolBarButton* pButton);

Parameters

[in] pButton
A pointer to the CMFCToolBarButton object that the user wants to customize.

Return Value

TRUE if the framework applies the user changes to the menu bar; otherwise FALSE.

Remarks

The default implementation for this method changes the text of the button to the text that the user provides.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual INT_PTR OnToolHitTest(
    CPoint point,  
    TOOLINFO* pTI) const;  

Parameters

[in] point
[in] pTI

Return Value

Remarks

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL PreTranslateMessage(MSG* pMsg);

Parameters

[in] pMsg

Return Value

Remarks

Called by the framework when the user selects Reset from the Customize dialog box.

virtual BOOL RestoreOriginalstate();

Return Value

Nonzero if the method is successful; otherwise 0.

Remarks

This method is called when the user selects Reset from the customization menu. You can also manually call this method to programmatically reset the state of the menu bar. This method loads the original state from the resource file.

Override this method if you want to do any processing when the user selects the Reset option.

Saves the state of the CMFCMenuBar object to the Windows registry.

virtual BOOL SaveState(
    LPCTSTR lpszProfileName=NULL,  
    int nIndex=-1,  
    UINT uiID=(UINT)-1);

Parameters

[in] lpszProfileName
A string that contains the path of a Windows registry key.

[in] nIndex
The control ID for the menu bar.

[in] uiID
A reserved value.

Return Value

TRUE if successful; otherwise FALSE;

Remarks

Usually, your application does not call SaveState. The framework calls this method when the workspace is serialized. For more information, see CWinAppEx::SaveState.

The saved information includes the menu items, the dock state, and the position of the menu bar.

Sets the default menu for a CMFCMenuBar object based on the resource ID.

void SetDefaultMenuResId(UINT uiResId);

Parameters

[in] uiResId
The resource ID for the new default menu.

Remarks

The CMFCMenuBar::RestoreOriginalstate method restores the default menu from the resource file.

Use the CMFCMenuBar::GetDefaultMenuResId method to retrieve the default menu without restoring it.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

void SetForceDownArrows(BOOL bValue);

Parameters

[in] bValue

Remarks

The framework calls this method when a MDI changes its display mode and the menu bar must be updated.

void SetMaximizeMode(
    BOOL bMax,  
    CWnd* pWnd = NULL,  
    BOOL bRecalcLayout = TRUE);

Parameters

[in] bMax
A Boolean that specifies the mode. See the Remarks section for more information.

[in] pWnd
A pointer to the MDI child window that is changing.

[in] bRecalcLayout
A Boolean that specifies whether the layout of the menu bar should be recalculated immediately.

Remarks

When an MDI child window is maximized, a menu bar attached to the MDI main frame window displays the system menu and the Minimize, Maximize and Close buttons. If bMax is TRUE and pWnd is not NULL, the MDI child window is maximized and the menu bar must incorporate the extra controls. Otherwise, the menu bar returns to its regular state.

Sets the runtime class information that the framework uses when the user creates menu buttons.

void SetMenuButtonRTC(CRuntimeClass* pMenuButtonRTC);

Parameters

[in] pMenuButtonRTC
The CRuntimeClass information for a class derived from the CMFCMenuButton Class.

Remarks

When a user adds new buttons to the menu bar, the framework creates the buttons dynamically. By default, it creates CMFCMenuButton objects. Override this method to change the type of button objects that the framework creates.

Sets the font for all menu bars in your application.

static BOOL SetMenuFont(
    LPLOGFONT lpLogFont,  
    BOOL bHorz = TRUE);

Parameters

[in] lpLogFont
A pointer to a LOGFONT structure that defines the font to set.

[in] bHorz
TRUE if you want the lpLogFont parameter to be used for the vertical font, FALSE if you want it to be used for horizontal font.

Return Value

TRUE if the method was successful; otherwise FALSE.

Remarks

Two fonts are used for all CMFCMenuBar objects. These separate fonts are used for horizontal and vertical menu bars.

The font settings are global variables and affect all CMFCMenuBar objects.

Controls whether a menu bar displays recently used menu commands.

static void SetRecentlyUsedMenus (BOOL bOn = TRUE);

Parameters

[in] bOn
A Boolean that controls whether recently used menu commands are displayed.

Controls whether a menu shows all the available commands.

static void SetShowAllCommands(BOOL bShowAllCommands = TRUE);

Parameters

[in] bShowAllCommands
A Boolean parameter that specifies whether the pop-up menu shows all the menu commands.

Remarks

If a menu does not display all the menu commands, it hides the commands that are rarely used. For more information about displaying menu commands, see CMFCMenuBar Class.

Hierarchy Chart
Classes
CMFCToolBar Class

Show: