ListView_GetNextItemIndex macro (commctrl.h)

Gets the index of the item in a particular list-view control that has the specified properties and relationship to another specific item. Use this macro or send the LVM_GETNEXTITEMINDEX message explicitly.

Syntax

void ListView_GetNextItemIndex(
  [in]       hwnd,
  [in, out]  plvii,
             flags
);

Parameters

[in] hwnd

Type: HWND

A handle to the list-view control.

[in, out] plvii

Type: LVITEMINDEX*

A pointer to the LVITEMINDEX structure with which the item begins the search, or -1 to find the first item that matches the specified flags. The calling process is responsible for allocating this structure and setting its members.

flags

Type: LPARAM

The relationship to the item specified in parameter plvii. 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.
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_PREVIOUS
Windows Vista and later: Searches for the item that is previous to the specified item. 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 essentially reverses the logic of the search performed via the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages.
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

None

Remarks

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

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header commctrl.h

See also

LVM_GETNEXTITEM