Tags Archives: cpp

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( [...]

Dump a CListCtrl

This snippet dumps the content of a CListCtrl in to a file. It also gets the number of columns in the list.   int GetColumnsCount( CListCtrl * list ) {     if( list != NULL )     {         const CHeaderCtrl * pHeaderCtrl = (CHeaderCtrl*) list->GetDlgItem(0);         if( pHeaderCtrl != NULL ) {             return  pHeaderCtrl->GetItemCount() [...]