CMFCTabToolTipInfo Structure

 

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 CMFCTabToolTipInfo Structure.

This structure provides information about the MDI tab that the user is hovering over.

struct CMFCTabToolTipInfo  

Data Members

NameDescription
CMFCTabToolTipInfo::m_nTabIndexSpecifies the index of the tab control.
CMFCTabToolTipInfo::m_pTabWndA pointer to the tab control.
CMFCTabToolTipInfo::m_strTextThe tooltip text.

A pointer to a CMFCTabToolTipInfo structure is passed as a parameter of the AFX_WM_ON_GET_TAB_TOOLTIP message. This message is generated when MDI tabs are enabled and the user hovers over a tab control.

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

LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
	CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
	ASSERT (pInfo != NULL);

	if (pInfo)
	{
		ASSERT_VALID (pInfo->m_pTabWnd);
		if (!pInfo->m_pTabWnd->IsMDITab ())
		{
			return 0;
		}
		pInfo->m_strText.Format (_T("Tab #%d Custom Tooltip"), pInfo->m_nTabIndex + 1);
	}

	return 0;
}

CMFCTabToolTipInfo

Header: afxbasetabctrl.h

Specifies the index of the tab control.

int m_nTabIndex;  

Remarks

Index of the tab over which the user is hovering.

Example

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

LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
	CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
	ASSERT (pInfo != NULL);

	if (pInfo)
	{
		ASSERT_VALID (pInfo->m_pTabWnd);
		if (!pInfo->m_pTabWnd->IsMDITab ())
		{
			return 0;
		}
		pInfo->m_strText.Format (_T("Tab #%d Custom Tooltip"), pInfo->m_nTabIndex + 1);
	}

	return 0;
}

A pointer to the tab control.

CMFCBaseTabCtrl* m_pTabWnd;  

Example

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

LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
	CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
	ASSERT (pInfo != NULL);

	if (pInfo)
	{
		ASSERT_VALID (pInfo->m_pTabWnd);
		if (!pInfo->m_pTabWnd->IsMDITab ())
		{
			return 0;
		}
		pInfo->m_strText.Format (_T("Tab #%d Custom Tooltip"), pInfo->m_nTabIndex + 1);
	}

	return 0;
}

The tooltip text.

CString m_strText;  

Remarks

If the string is empty, the tooltip is not displayed.

Example

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

LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
	CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
	ASSERT (pInfo != NULL);

	if (pInfo)
	{
		ASSERT_VALID (pInfo->m_pTabWnd);
		if (!pInfo->m_pTabWnd->IsMDITab ())
		{
			return 0;
		}
		pInfo->m_strText.Format (_T("Tab #%d Custom Tooltip"), pInfo->m_nTabIndex + 1);
	}

	return 0;
}

Hierarchy Chart
Classes

Show: