How to find the text column header of a CListCtrl in MFC
How to find the text column header of a CListCtrl in MFC
CString GetColumnName( CListCtrl * list, int nCol )
{
CString strNome;
CHeaderCtrl* pHdr = list->GetHeaderCtrl();
if ( pHdr )
if ( nCol < pHdr->GetItemCount() )
{
HDITEM hdi;
hdi.mask = HDI_TEXT;
hdi.pszText = strNome.GetBuffer( 256 );
hdi.cchTextMax = 256;
pHdr->GetItem( nCol, &hdi );
strNome.ReleaseBuffer();
}
return strNome;
}
Leave a comment