List Control and List View

HomeOverviewSample

For convenience, MFC encapsulates the list control in two ways. You can use list controls:

CListView makes it easy to integrate a list control with the MFC document/view architecture, encapsulating the control much as CEditView encapsulates an edit control: the control fills the entire surface area of an MFC view. (The view is the control, cast to CListView.)

A CListView object inherits from CCtrlView and its base classes and adds a member function to retrieve the underlying list control. Use view members to work with the view as a view. Use the GetListCtrl member function to gain access to the list control's member functions. Use these members to:

To obtain a reference to the CListCtrl underlying a CListView, call GetListCtrl from your list view class:

CListCtrl& ctlList = GetListCtrl();

This article describes both ways to use the list control.

See Also   Windows Common Controls and MFC Classes