Share via


CFrameWnd::SetMenuBarVisibility

Sets the default behavior of the menu in the current MFC application to be either hidden or visible.

virtual void SetMenuBarVisibility(
    DWORD nStyle
);

Parameters

Parameter

Description

[in] nStyle

Specifies whether the menu is by default hidden, or is visible and has the focus. The nStyle parameter can have the following values:

  • AFX_MBV_KEEPVISIBLE (0x01) -

    The menu is displayed at all times, and by default does not have the focus.

  • AFX_MBV_DISPLAYONFOCUS (0x02) -

    The menu is hidden by default. If the menu is hidden, press the ALT key to display the menu and give it the focus. If the menu is displayed, press the ALT or ESC key to hide menu.

  • AFX_MBV_ DISPLAYONFOCUS (0x02) | AFX_MBV_DISPLAYONF10 (0x04)

    (bitwise combination (OR)) - The menu is hidden by default. If the menu is hidden, press the F10 key to display the menu and give it the focus. If the menu is displayed, press the F10 key to toggle the focus on or off the menu. The menu is displayed until you press the ALT or ESC key to hide it.

Remarks

If the value of the nStyle parameter is not valid, this method asserts in Debug mode and raises CInvalidArgException in Release mode. In case of other runtime errors, this method asserts in Debug mode and raises an exception derived from the CException class.

This method affects the state of menus in applications written for Windows Vista and later.

Requirements

Header: afxwin.h

See Also

Reference

CFrameWnd Class

Hierarchy Chart

CFrameWnd::GetMenuBarVisibility