LVITEM
A version of this page is also available for
4/8/2010
This structure that specifies or receives the attributes of a list-view item. It has been updated to support a new mask value (LVIF_INDENT) that enables item indenting.
Syntax
typedef struct _LVITEM {
UINT mask;
int iItem;
int iSubItem;
UINT state;
UINT stateMask;
LPTSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
#if (_WIN32_IE >= 0x0300)
int iIndent;
#endif
int iGroupId;
} LVITEM;
Members
mask
Specifies which members of this structure contain data to be set or are being requested. It can be a combination of one or more of the following flags.Value Description LVIF_GROUPID
The iGroupId member is valid or must be filled in.
LVIF_TEXT
The pszText member is valid or must be filled in.
LVIF_IMAGE
The iImage member is valid or must be filled in.
LVIF_INDENT
The iIndent member is valid or must be filled in.
LVIF_NORECOMPUTE
The control will not generate a LVN_GETDISPINFO message to retrieve text information if it receives a LVM_GETITEM message. Instead, the pszText member will contain LPSTR_TEXTCALLBACK.
LVIF_PARAM
The lParam member is valid or must be filled in.
LVIF_STATE
The state member is valid or must be filled in.
LVIF_DI_SETITEM
The operating system should store the requested list item information, and not ask for it again. This flag is used only with the LVN_GETDISPINFO message.
- iItem
Zero-based index of the item to which this structure refers.
- iSubItem
One-based index of the subitem to which this structure refers, or zero if this structure refers to an item rather than a subitem.
- state
Current state of the item if the item's state is being retrieved, or the new state if the item's state is being set. The stateMask member specifies which bits of this member should be retrieved or modified. Any bits in this member that are not set in stateMask will be ignored. This member can be any valid combination of list-view state values.
stateMask
Specifies which bits of the state member will be retrieved or modified.If the item's state is being retrieved, this member enables you to specify which states will be retrieved. For example, setting this member to LVIS_SELECTED will cause only the item's selection state to be retrieved.
If item's state is being modified, this member allows you to modify one or more states without having to retrieve all of the states first. For example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the other states will be affected.
To retrieve or modify all of the states, set this member to (UINT) –1.
pszText
Pointer to a null-terminated string that contains the item text if the structure specifies item attributes. If this member is the LPSTR_TEXTCALLBACK value, the item is a callback item. Do not set the pszText member to LPSTR_TEXTCALLBACK if the list-view control has LVS_SORTASCENDING or LVS_SORTDESCENDING style.If the structure is receiving item attributes, this member is the pointer to the buffer that receives the item text.
- cchTextMax
Size of the buffer pointed to by the pszText member. If the structure is not receiving information, this member is ignored.
iImage
Index of the list-view item's icon in the icon list and the small icon image list.If this member is the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the list-view control sends the parent an LVN_GETDISPINFO message to get the index when it needs to display the image.
- lParam
Specifies the 32-bit value of the item. If you use the LVM_SORTITEMS message, the list-view control passes this value to the application-defined comparison function. You can also use the LVM_FINDITEM message to search a list-view control for an item with a specified lParam value.
- iIndent
Number of image widths to indent the item. A single indentation equals the width of an item image. Therefore, the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this member is supported only for items. Attempting to set subitem indentation will cause the calling function to fail.
iGroupId
Identifier (ID) of the group. It can be one of the following values.Value Description I_GROUPIDCALLBACK
The listview control sends the parent an LVN_GETDISPINFO notification message to retrieve the index of the group
I_GROUPIDNONE
The listview control has no group.
Remarks
The LVITEM structure is used with a number of messages, including LVM_GETITEM, LVM_SETITEM, LVM_INSERTITEM, and LVM_DELETEITEM.
This structure supersedes the LV_ITEM structure.
Size of the buffer pointed to by the pszText member if the structure is receiving item attributes. This member is ignored if the structure specifies item attributes.
Requirements
Header | commctrl.h |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |