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;
}

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>