LVM_GETNEXTITEM message

Searches for a list-view item that has the specified properties and bears the specified relationship to a specified item. You can send this message explicitly or by using the ListView_GetNextItem macro.

Parameters

wParam

Index of the item to begin the search with, or -1 to find the first item that matches the specified flags. The specified item itself is excluded from the search.

lParam

Specifies the relationship to the item specified in wParam. This can be one or a combination of the following values:

Value Meaning
Searches by index.
LVNI_ALL
Searches for a subsequent item by index, the default value.
LVNI_PREVIOUS
Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The LVNI_PREVIOUS flag is not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item ordered before.) The LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages.
Searches by physical relationship to the index of the item where the search is to begin.
LVNI_ABOVE
Searches for an item that is above the specified item.
LVNI_BELOW
Searches for an item that is below the specified item.
LVNI_TOLEFT
Searches for an item to the left of the specified item.
LVNI_TORIGHT
Searches for an item to the right of the specified item.
LVNI_DIRECTIONMASK
Windows Vista and later: A directional flag mask with value as follows: LVNI_ABOVE | LVNI_BELOW | LVNI_TOLEFT | LVNI_TORIGHT.
The state of the item to find can be specified with one or a combination of the following values:
LVNI_CUT
The item has the LVIS_CUT state flag set.
LVNI_DROPHILITED
The item has the LVIS_DROPHILITED state flag set
LVNI_FOCUSED
The item has the LVIS_FOCUSED state flag set.
LVNI_SELECTED
The item has the LVIS_SELECTED state flag set.
LVNI_STATEMASK
Windows Vista and later: A state flag mask with value as follows: LVNI_FOCUSED | LVNI_SELECTED | LVNI_CUT | LVNI_DROPHILITED.
Searches by appearance of items or by group
LVNI_VISIBLEORDER
Windows Vista and later: Search the visible order.
LVNI_VISIBLEONLY
Windows Vista and later: Search the visible items.
LVNI_SAMEGROUPONLY
Windows Vista and later: Search the current group.
If an item does not have all of the specified state flags set, the search continues with the next item.

Return value

Returns the index of the next item if successful, or -1 otherwise.

Remarks

Note that the following flags, for use only with Windows Vista, are mutually exclusive of any other flags in use: LVNI_VISIBLEONLY, LVNI_SAMEGROUPONLY, LVNI_VISIBLEORDER, LVNI_DIRECTIONMASK, and LVNI_STATEMASK.

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Commctrl.h