Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This macro sets some or all of a list-view item's attributes. You can also use ListView_SetItemto set the text of a subitem. You can use this macro or send the LVM_SETITEM message explicitly.

Syntax

BOOL ListView_SetItem( 
  HWND 
hwnd, 
  const LVITEM FAR* 
pitem 
);

Parameters

hwnd

Handle to the list-view control.

pitem

Pointer to an LVITEMstructure that contains the new item attributes. The iItemand iSubItemmembers identify the item or subitem, and the maskmember specifies which attributes to set.

If the maskmember specifies the LVIF_TEXT value, the pszTextmember is the address of a null-terminated string and the cchTextMaxmember is ignored.

If the maskmember specifies the LVIF_STATE value, the stateMaskmember specifies which item states to change, and the statemember contains the values for those states.

Return Value

TRUE indicates success. FALSE indicates failure.

Remarks

To set the attributes of a list-view item, set the iItemmember of the LVITEMstructure to the index of the item, and set the iSubItemmember to zero. For an item, you can use the state, pszText, iImage, and lParammembers of the LVITEMstructure to modify these item parameters.

To set the text of a subitem, set the iItemand iSubItemmembers to indicate the specific subitem, and use the pszTextmember to specify the text. Alternatively, you can use the ListView_SetItemTextmacro to set the text of a subitem. You cannot set the stateor lParammembers for subitems because subitems do not have these attributes. You can set the iImagemember for subitems. The subitem image will be displayed if the list-view control has the LVS_EX_SUBITEMIMAGES extended style.

Related message:  LVM_SETITEM

Requirements

Header commctrl.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also