Share via


Adding Items to the Control

OverviewSample

To add items to the list control (), call one of several versions of the member function, depending on what information you have. One version takes a structure that you prepare. Because the LV_ITEM structure contains numerous members, you have greater control over the attributes of the list control item.

Two important members (in regard to the report view) of the LV_ITEM structure are the iItem and iSubItem members. The iItem member is the zero-based index of the item the structure is referencing and the iSubItem member is the one-based index of a subitem, or zero if the structure contains information about an item. With these two members you determine, per item, the type and value of subitem information that is displayed when the list control is in report view. For more information, see .

Additional members specify the item's text, icon, state, and item data. "Item data" is an application-defined value associated with a list view item. For more information about the LV_ITEM structure, see .

Other versions of InsertItem take one or more separate values, corresponding to members in the LV_ITEM structure, allowing you to initialize only those members you want to support. Generally, the list control manages storage for list items, but you can store some of the information in your application instead, using "callback items." For more information, see Callback Items and the Callback Mask in this article and in the Platform SDK.

For more information, see

See Also   Windows Common Controls and MFC Classes