List View Control Reference

List View Control Reference


This section contains information about the programming elements used with list view controls.

List view window styles

Extended list view styles

List view item states

Messages
LVM_APPROXIMATEVIEWRECT
LVM_ARRANGE
LVM_CREATEDRAGIMAGE
LVM_DELETEALLITEMS
LVM_DELETECOLUMN
LVM_DELETEITEM
LVM_EDITLABEL
LVM_ENSUREVISIBLE
LVM_FINDITEM
LVM_GETBKCOLOR
LVM_GETBKIMAGE
LVM_GETCALLBACKMASK
LVM_GETCOLUMN
LVM_GETCOLUMNORDERARRAY
LVM_GETCOLUMNWIDTH
LVM_GETCOUNTPERPAGE
LVM_GETEDITCONTROL
LVM_GETEXTENDEDLISTVIEWSTYLE
LVM_GETHEADER
LVM_GETHOTCURSOR
LVM_GETHOTITEM
LVM_GETHOVERTIME
LVM_GETIMAGELIST
LVM_GETISEARCHSTRING
LVM_GETITEM
LVM_GETITEMCOUNT
LVM_GETITEMPOSITION
LVM_GETITEMRECT
LVM_GETITEMSPACING
LVM_GETITEMSTATE
LVM_GETITEMTEXT
LVM_GETNEXTITEM
LVM_GETNUMBEROFWORKAREAS
LVM_GETORIGIN
LVM_GETSELECTEDCOUNT
LVM_GETSELECTIONMARK
LVM_GETSTRINGWIDTH
LVM_GETSUBITEMRECT
LVM_GETTEXTBKCOLOR
LVM_GETTEXTCOLOR
LVM_GETTOOLTIPS
LVM_GETTOPINDEX
LVM_GETUNICODEFORMAT
LVM_GETVIEWRECT
LVM_GETWORKAREAS
LVM_HITTEST
LVM_INSERTCOLUMN
LVM_INSERTITEM
LVM_REDRAWITEMS
LVM_SCROLL
LVM_SETBKCOLOR
LVM_SETBKIMAGE
LVM_SETCALLBACKMASK
LVM_SETCOLUMN
LVM_SETCOLUMNORDERARRAY
LVM_SETCOLUMNWIDTH
LVM_SETEXTENDEDLISTVIEWSTYLE
LVM_SETHOTCURSOR
LVM_SETHOTITEM
LVM_SETHOVERTIME
LVM_SETICONSPACING
LVM_SETIMAGELIST
LVM_SETITEM
LVM_SETITEMCOUNT
LVM_SETITEMPOSITION
LVM_SETITEMPOSITION32
LVM_SETITEMSTATE
LVM_SETITEMTEXT
LVM_SETSELECTIONMARK
LVM_SETTEXTBKCOLOR
LVM_SETTEXTCOLOR
LVM_SETTOOLTIPS
LVM_SETUNICODEFORMAT
LVM_SETWORKAREAS
LVM_SORTITEMS
LVM_SUBITEMHITTEST
LVM_UPDATE

Utility Macros
ListView_ApproximateViewRect
ListView_Arrange
ListView_CreateDragImage
ListView_DeleteAllItems
ListView_DeleteColumn
ListView_DeleteItem
ListView_EditLabel
ListView_EnsureVisible
ListView_FindItem
ListView_GetBkColor
ListView_GetBkImage
ListView_GetCallbackMask
ListView_GetCheckState
ListView_GetColumn
ListView_GetColumnOrderArray
ListView_GetColumnWidth
ListView_GetCountPerPage
ListView_GetEditControl
ListView_GetExtendedListViewStyle
ListView_GetHeader
ListView_GetHotCursor
ListView_GetHotItem
ListView_GetImageList
ListView_GetISearchString
ListView_GetItem
ListView_GetItemCount
ListView_GetItemPosition
ListView_GetItemRect
ListView_GetItemSpacing
ListView_GetItemState
ListView_GetItemText
ListView_GetNextItem
ListView_GetNumberOfWorkAreas
ListView_GetOrigin
ListView_GetSelectedCount
ListView_GetSelectionMark
ListView_GetStringWidth
ListView_GetSubItemRect
ListView_GetTextBkColor
ListView_GetTextColor
ListView_GetToolTips
ListView_GetTopIndex
ListView_GetUnicodeFormat
ListView_GetViewRect
ListView_GetWorkAreas
ListView_HitTest
ListView_InsertColumn
ListView_InsertItem
ListView_RedrawItems
ListView_Scroll
ListView_SetBkColor
ListView_SetBkImage
ListView_SetCallbackMask
ListView_SetColumn
ListView_SetColumnOrderArray
ListView_SetColumnWidth
ListView_SetExtendedListViewStyle
ListView_SetExtendedListViewStyleEx
ListView_SetHotCursor
ListView_SetHotItem
ListView_SetIconSpacing
ListView_SetImageList
ListView_SetItem
ListView_SetItemCount
ListView_SetItemCountEx
ListView_SetItemPosition
ListView_SetItemPosition32
ListView_SetItemState
ListView_SetItemText
ListView_SetSelectionMark
ListView_SetTextBkColor
ListView_SetTextColor
ListView_SetToolTips
ListView_SetUnicodeFormat
ListView_SetWorkAreas
ListView_SortItems
ListView_SubItemHitTest
ListView_Update

Notifications
LVN_BEGINDRAG
LVN_BEGINLABELEDIT
LVN_BEGINRDRAG
LVN_COLUMNCLICK
LVN_DELETEALLITEMS
LVN_DELETEITEM
LVN_ENDLABELEDIT
LVN_GETDISPINFO
LVN_GETINFOTIP
LVN_HOTTRACK
LVN_INSERTITEM
LVN_ITEMACTIVATE
LVN_ITEMCHANGED
LVN_ITEMCHANGING
LVN_KEYDOWN
LVN_MARQUEEBEGIN
LVN_ODCACHEHINT
LVN_ODFINDITEM
LVN_ODSTATECHANGED
LVN_SETDISPINFO
NM_CLICK (list view)
NM_CUSTOMDRAW (list view)
NM_DBLCLK (list view)
NM_HOVER (list view)
NM_KILLFOCUS (list view)
NM_RCLICK (list view)
NM_RDBLCLK (list view)
NM_RELEASEDCAPTURE (list view)
NM_RETURN (list view)
NM_SETFOCUS (list view)

Structures
LV_COLUMN
LV_DISPINFO
LV_FINDINFO
LV_HITTESTINFO
LV_ITEM
LV_KEYDOWN
LVBKIMAGE
LVCOLUMN
LVFINDINFO
LVHITTESTINFO
LVITEM
NM_LISTVIEW
NMITEMACTIVATE
NMLISTVIEW
NMLVCACHEHINT
NMLVCUSTOMDRAW
NMLVDISPINFO
NMLVFINDITEM
NMLVGETINFOTIP
NMLVKEYDOWN
NMLVODSTATECHANGE

List View Control Constants

The following sections describe window style flags and item state flags that are used with list view controls.

List view window styles

The following window styles are specific to list view controls.
LVS_ALIGNLEFT Specifies that items are left-aligned in icon and small icon view.
LVS_ALIGNTOP Specifies that items are aligned with the top of the list view control in icon and small icon view.
LVS_AUTOARRANGE Specifies that icons are automatically kept arranged in icon and small icon view.
LVS_EDITLABELS Allows item text to be edited in place. The parent window must process the LVN_ENDLABELEDIT notification message.
LVS_ICON Specifies icon view.
LVS_LIST Specifies list view.
LVS_NOCOLUMNHEADER Specifies that a column header is not displayed in report view. By default, columns have headers in report view.
LVS_NOLABELWRAP Displays item text on a single line in icon view. By default, item text may wrap in icon view.
LVS_NOSCROLL Disables scrolling. All items must be within the client area.
LVS_NOSORTHEADER Specifies that column headers do not work like buttons. This style can be used if clicking a column header in report view does not carry out an action, such as sorting.
LVS_OWNERDATA Version 4.70. Specifies a virtual list view control. For more information about this list control style, see Virtual list view description.
LVS_OWNERDRAWFIXED Enables the owner window to paint items in report view. The list view control sends a WM_DRAWITEM message to paint each item; it does not send separate messages for each subitem. The itemData member of the DRAWITEMSTRUCT structure contains the item data for the specified list view item.
LVS_REPORT Specifies report view. When using the LVS_REPORT style with a list view control, the first column is always left-aligned. You cannot use LVCFMT_RIGHT to change this alignment.
LVS_SHAREIMAGELISTS Specifies that the image list will not be deleted when the control is destroyed. This style enables the use of the same image lists with multiple list view controls.
LVS_SHOWSELALWAYS Always show the selection, if any, even if the control does not have the focus.
LVS_SINGLESEL Allows only one item at a time to be selected. By default, multiple items may be selected.
LVS_SMALLICON Specifies small icon view.
LVS_SORTASCENDING Sorts items based on item text in ascending order.
LVS_SORTDESCENDING Sorts items based on item text in descending order.

You can use the LVS_TYPEMASK mask to isolate the window styles that correspond to the current view: LVS_ICON, LVS_SMALLICON, LVS_LIST, and LVS_REPORT.

You can use the LVS_ALIGNMASK mask to isolate the window styles that specify the alignment of items: LVS_ALIGNLEFT and LVS_ALIGNTOP.

You can use the LVS_TYPESTYLEMASK mask to isolate the window styles that control item alignment (LVS_ALIGNLEFT and LVS_ALIGNTOP) and those that control header appearance and behavior (LVS_NOCOLUMNHEADER and LVS_NOSORTHEADER).

Extended list view styles

List view control styles have been extended. To use these new styles, use the LVM_SETEXTENDEDLISTVIEWSTYLE message or one of the ListView_SetExtendedListViewStyle or ListView_SetExtendedListViewStyleEx macros.
LVS_EX_CHECKBOXES Version 4.70. Enables check boxes for items in a list view control. Effectively, when set to this style, the control will create and set a state image list using DrawFrameControl. Check boxes are visible and functional with all list view modes. The state of the check box for a given item is obtained using the ListView_GetCheckState macro.
LVS_EX_FLATSB Version 4.71. Enables flat scroll bars in the list view. If you need more control over the appearance of the list view's scroll bars, you should manipulate the list view's scroll bars directly using the Flat Scroll Bar APIs.
LVS_EX_FULLROWSELECT Version 4.70. When an item is selected, the item and all its subitems are highlighted. This style is available only in conjunction with the LVS_REPORT style.
LVS_EX_GRIDLINES Version 4.70. Displays gridlines around items and subitems. This style is available only in conjunction with the LVS_REPORT style.
LVS_EX_HEADERDRAGDROP Version 4.70. Enables drag-and-drop reordering of columns in a list view control. This style is only available to list view controls that use the LVS_REPORT style.
LVS_EX_INFOTIP Version 4.71. The list view control sends an LVN_GETINFOTIP notification message to the parent window before displaying an item's tooltip. This style is only available to list view controls that use the LVS_ICON style.
LVS_EX_MULTIWORKAREAS Version 4.71. If the list view control has the LVS_AUTOARRANGE style, the control will not autoarrange its icons until one or more work areas are defined (see LVM_SETWORKAREAS). To be effective, this style must be set before any work areas are defined and any items have been added to the control.
LVS_EX_ONECLICKACTIVATE Version 4.70. The list view control sends an LVN_ITEMACTIVATE notification message to the parent window when the user clicks an item. This style also enables hot tracking in the list view control. Hot tracking means that when the cursor moves over an item, it is highlighted but not selected.
LVS_EX_REGIONAL Version 4.71. The list view will create a region that includes only the item icons and text and set its window region to that using SetWindowRgn. This will exclude any area that is not part of an item from the window region. This style is only available to list view controls that use the LVS_ICON style.
LVS_EX_SUBITEMIMAGES Version 4.70. Allows images to be displayed for subitems. This style is available only in conjunction with the LVS_REPORT style.
LVS_EX_TRACKSELECT Version 4.70. Enables hover selection in a list view control. Hover selection (also called track selection) means that an item is automatically selected when the cursor remains over the item for a certain period of time. The delay can be changed from the default system setting with the LVM_SETHOVERTIME message. This style applies to all styles of list view control.
LVS_EX_TWOCLICKACTIVATE Version 4.70. The list view control sends an LVN_ITEMACTIVATE notification message to the parent window when the user double-clicks an item. This style also enables hot tracking in the list view control. Hot tracking means that when the cursor moves over an item, it is highlighted but not selected.
LVS_EX_UNDERLINECOLD Version 4.71. Causes nonhot items to be displayed with underlined text. This style is ignored if LVS_EX_ONECLICKACTIVATE is not set.
LVS_EX_UNDERLINEHOT Version 4.71. Causes hot items to be displayed with underlined text. This style is ignored if LVS_EX_ONECLICKACTIVATE or LVS_EX_TWOCLICKACTIVATE is not set.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.