Header Control and List Control
In most cases, you will use the header control that is embedded in a or object. However, there are cases where a separate header control object is desirable, such as manipulating data, arranged in columns or rows, in a -derived object. In these cases, you need greater control over the appearance and default behavior of an embedded header control.
In the common case that you want a header control to provide standard, default behavior, you may want to use or instead. Use CListCtrl when you want the functionality of a default header control, embedded in a list view common control. Use when you want the functionality of a default header control, embedded in a view object.
Note These controls only include a built-in header control if the list view control is created using the LVS_REPORT style.
In most cases, the appearance of the embedded header control can be modified by changing the styles of the containing list view control. In addition, information about the header control can be obtained through member functions of the parent list view control. However, for complete control, and access, to the attributes and styles of the embedded header control, it is recommended that a pointer to the header control object be obtained.
The embedded header control object can be accessed from either CListCtrl or CListView with a call to the respective class's GetHeaderCtrl member function. The following code demonstrates this:
CListCtrl& refList = GetListCtrl();
CHeaderCtrl* pCtrl = refList.GetHeaderCtrl();
ASSERT(pCtrl != NULL);
//perform any needed operations on the header
//using pHeader