Date: 2008jul12
Platform: MFC
Language: C/C++
Q. How can I find the number of columns in a CListCtrl ?
A. Use this function:
int GetColumnCount(const CListCtrl *pListCtrl)
{
CHeaderCtrl* pHeader;
if (pListCtrl == NULL) return 0;
if ((pHeader = const_cast<MyListCtrl*>(pListCtrl)->GetHeaderCtrl()) ==
NULL) return 0;
return pHeader->GetItemCount();
}
void ExampleUse()
{
CListCtrl ctrl;
int n;
n = GetColumnCount(&ctrl);
printf("There are %d columns\n", n);
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment