Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


Enables or disables the MDI Tabs feature for the MDI frame window. When enabled, the frame window displays a tab for each MDI child window.

void EnableMDITabs(
   BOOL bEnable=TRUE,
   BOOL bIcons=TRUE,
   CMFCTabCtrl::Location tabLocation=CMFCTabCtrl::LOCATION_BOTTOM,
   BOOL bTabCloseButton=FALSE,
   CMFCTabCtrl::Style style=CMFCTabCtrl::STYLE_3D_SCROLLED,
   BOOL bTabCustomTooltips=FALSE,
   BOOL bActiveTabCloseButton=FALSE 


Specifies whether tabs are enabled.


Specifies whether icons should be displayed on the tabs.


Specifies the location of the tab labels.


Specifies whether to display tab close buttons.


Specifies the style of tabs. Use STYLE_3D_SCROLLED for regular tabs or STYLE_3D_ONENOTE for Microsoft OneNote tabs.


Specifies whether custom tooltips are enabled.


If TRUE, a Close button will be displayed on the active tab instead of on the right corner of the tab area.

Call this method to enable or disable the MDI tabs feature for the MDI frame window. When enabled, all child windows are displayed as tabs.

The tab labels can be located at the top or bottom of the frame, depending on the setting of the parameter tabLocation. You may specify either CMFCTabCtrl::LOCATION_BOTTOM (the default setting) or CMFCTabCtrl::LOCATION_TOP.

If bTabCustomTooltips is TRUE, an AFX_WM_ON_GET_TAB_TOOLTIP message will be sent to the main frame window. Your code can handle this message and provide the framework with custom tooltips for MDI tabs.

The following example shows how EnableMDITabs is used in the MDITabsDemo Sample: MFC Tabbed MDI Application.

void CMainFrame::UpdateMDITabs (BOOL bResetMDIChild)
	CMDITabInfo params;
	HWND hwndActive = NULL;

	switch (theApp.m_Options.m_nMDITabsType)
	case CMDITabOptions::None:
			BOOL bCascadeMDIChild = FALSE;

			if (IsMDITabbedGroup ())
				EnableMDITabbedGroups (FALSE, params);
				bCascadeMDIChild = TRUE;
			else if (AreMDITabs ())
				EnableMDITabs (FALSE);
				bCascadeMDIChild = TRUE;

			if (bCascadeMDIChild)
				// CMDIClientAreaWnd m_wndClientArea
				hwndActive = (HWND) m_wndClientArea.SendMessage (WM_MDIGETACTIVE);
				m_wndClientArea.PostMessage (WM_MDICASCADE);
				m_wndClientArea.UpdateTabs( false );
				::BringWindowToTop (hwndActive);

	case CMDITabOptions::MDITabsStandard:
		hwndActive = (HWND) m_wndClientArea.SendMessage (WM_MDIGETACTIVE);
		m_wndClientArea.PostMessage (WM_MDIMAXIMIZE, LPARAM(hwndActive), 0L);
		::BringWindowToTop (hwndActive);

		EnableMDITabs (TRUE,theApp.m_Options.m_bMDITabsIcons, theApp.m_Options.m_bTabsOnTop ? CMFCTabCtrl::LOCATION_TOP : CMFCTabCtrl::LOCATION_BOTTOM, theApp.m_Options.m_nTabsStyle);

		GetMDITabs().EnableAutoColor (theApp.m_Options.m_bTabsAutoColor);
		GetMDITabs().EnableTabDocumentsMenu (theApp.m_Options.m_bMDITabsDocMenu);
		GetMDITabs().EnableTabSwap (theApp.m_Options.m_bDragMDITabs);
		GetMDITabs().SetTabBorderSize (theApp.m_Options.m_nMDITabsBorderSize);
		GetMDITabs().SetFlatFrame (theApp.m_Options.m_bFlatFrame);
		GetMDITabs().EnableCustomToolTips (theApp.m_Options.m_bCustomTooltips);
		GetMDITabs().EnableCustomToolTips (theApp.m_Options.m_bCustomTooltips);
		GetMDITabs().EnableActiveTabCloseButton (theApp.m_Options.m_bActiveTabCloseButton);

Header: afxMDIFrameWndEx.h

© 2015 Microsoft