WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
To get the number of columns in the list view control, we first get a pointer to the header control and then use the header control to query the number of columns it has.
CHeaderCtrl* pHeader = (CHeaderCtrl*) m_listctrl.GetDlgItem(0); int nColumnCount = pHeader->GetItemCount();This works even when the listview control has the LVS_NOCOLUMNHEADER style. It also works if the control is not in the report view.