我初始化一个ListControl时,添加了NO,Name,Age的列标题,现在需要获取这些标题,用什么函数能实现啊。请帮忙

解决方案 »

  1.   

    LVCOLUMN lvcol;
          char  str[256];
          int   nColNum;
          CString  strColumnName[4];//假如有4列      nColNum = 0;
          lvcol.mask = LVCF_TEXT;
          lvcol.pszText = str;
          lvcol.cchTextMax = 256;
          while(m_list.GetColumn(nColNum, &lvcol))
          {
               strColumnName[nColNum] = lvcol.pszText;
               nColNum++;
          }
      

  2.   

    可以用CListCtrl的成员函数
    BOOL GetColumn( int nCol, LVCOLUMN* pColumn ) const;如:
    LVCOLUMN Column;
    GetColumn( 0, &Column ) ;//获得第0列的信息//标题就可以在Column.pszText中获得