class CMyListView : public CListView
{
CToolTipCtrl m_tip;
};
void CMyListView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
m_tip.Create( this );
int i;
for ( i = 0; i < 3; i++ )
{
CString sText;
sText.Format( _T( "%03d" ), i );
GetListCtrl().InsertColumn( i, sText, 0, 100 );
CRect rect;
GetListCtrl().GetHeaderCtrl()->GetItemRect( i, &rect );
m_tip.AddTool( GetListCtrl().GetHeaderCtrl(), sText, &rect, i + 1 );
}
}
BOOL CMyListView:

reTranslateMessage(MSG* pMsg)
{
m_tip.RelayEvent( pMsg );
return CListView:

reTranslateMessage(pMsg);
}
もしくは、
BOOL CMyListView:

reTranslateMessage(MSG* pMsg)
{
if ( pMsg->message == WM_MOUSEMOVE
&& pMsg->hwnd == GetListCtrl().GetHeaderCtrl()->GetSafeHwnd() )
{
int x = LOWORD( pMsg->lParam );
int y = HIWORD( pMsg->lParam );
CRect rect;
int i;
for ( i = 0; i < GetListCtrl().GetHeaderCtrl()->GetItemCount(); i++ )
{
GetListCtrl().GetHeaderCtrl()->GetItemRect( i, &rect );
if ( rect.left <= x && x < rect.right )
{
TCHAR pBuff[ 256 ];
HDITEM item;
item.mask = HDI_TEXT;
item.pszText = pBuff;
item.cchTextMax = sizeof( pBuff ) / sizeof( TCHAR );
GetListCtrl().GetHeaderCtrl()->GetItem( i, &item );
TRACE( _T( "%s\n" ), item.pszText );
}
}
}
return CListView::PreTranslateMessage(pMsg);
}