
LVM_SCROLL
wParam = (int) dx;
lParam = (int) dy;
Scrolls the content of a list view control. You can send this message explicitly or by using the ListView_Scroll macro.
When the list view control is in report view, the control can only be scrolled vertically in whole line increments. Therefore, the dy parameter will be rounded to the nearest number of pixels that form a whole line increment. For example, if the height of a line is 16 pixels and 8 is passed for dy, the list will be scrolled by 16 pixels (1 line). If 7 is passed for dy, the list will be scrolled 0 pixels (0 lines).
LVM_SETBKCOLOR
wParam = 0;
lParam = (LPARAM) (COLORREF) clrBk;
Sets the background color of a list view control. You can send this message explicitly or by using the ListView_SetBkColor macro.
LVM_SETBKIMAGE
wParam = 0;
lParam = (LPARAM)(LPLVBKIMAGE) plvbki;
Sets the background image in a list view control. You can send this message explicitly or by using the ListView_SetBkImage macro.
Because the list view control uses OLE COM to manipulate the background images, the calling application must call CoInitialize or OleInitialize before sending this message. It is best to call one of these functions when the application is initialized and call either CoUnitialize or OleUnitialize when the application is terminating.
Version 4.71
See also LVM_GETBKIMAGE
LVM_SETCALLBACKMASK
wParam = (WPARAM) (UINT) mask;
lParam = 0;
Changes the callback mask for a list view control. You can send this message explicitly or by using the ListView_SetCallbackMask macro.
| LVIS_CUT | The item is marked for a cut-and-paste operation. |
| LVIS_DROPHILITED | The item is highlighted as a drag-and-drop target. |
| LVIS_FOCUSED | The item has the focus. |
| LVIS_SELECTED | The item is selected. |
| LVIS_OVERLAYMASK | The application stores the image list index of the current overlay image for each item. |
| LVIS_STATEIMAGEMASK | The application stores the image list index of the current state image for each item. |
The callback mask of a list view control is a set of bit flags that specify the item states for which the application, rather than the control, stores the current data. The callback mask applies to all of the control's items, unlike the callback item designation, which applies to a specific item. The callback mask is zero by default, meaning that the list view control stores all item state information. After creating a list view control and initializing its items, you can send the LVM_SETCALLBACKMASK message to change the callback mask. To get the current callback mask, send the LVM_GETCALLBACKMASK message.
For more information about overlay images and state images, see List View Image Lists.
For more information on list view callbacks, see Callback Items and the Callback Mask.
See also LVN_GETDISPINFO
LVM_SETCOLUMN
wParam = (WPARAM) (int) iCol;
lParam = (LPARAM) (const LPLVCOLUMN) pcol;
Sets the attributes of a list view column. You can send this message explicitly or by using the ListView_SetColumn macro.
LVM_SETCOLUMNORDERARRAY
wParam = (WPARAM) (int) iCount;
lParam = (LPARAM) (LPINT) lpiArray;
Sets the left-to-right order of columns in a list view control. You can send this message explicitly or use the ListView_SetColumnOrderArray macro.
Version 4.70
LVM_SETCOLUMNWIDTH
wParam = (WPARAM) (int) iCol;
lParam = MAKELPARAM((int) cx, 0);
Changes the width of a column in report or list view. You can send this message explicitly or by using the ListView_SetColumnWidth macro.
| LVSCW_AUTOSIZE | Automatically sizes the column. |
| LVSCW_AUTOSIZE_USEHEADER | Automatically sizes the column to fit the header text. |
LVM_SETEXTENDEDLISTVIEWSTYLE
wParam = (WPARAM)dwExMask;
lParam = (LPARAM)dwExStyle;
Sets extended styles in list view controls. You can send this message explicitly or use the ListView_SetExtendedListViewStyle or ListView_SetExtendedListViewStyleEx macros.
dwExMask allows you to modify one or more extended styles without having to retrieve the existing styles first. For example, if you pass LVS_EX_FULLROWSELECT for dwExMask and 0 for dwExStyle, the LVS_EX_FULLROWSELECT style will be cleared, but all other styles will remain the same.
For backward compatibility reasons, the ListView_SetExtendedListViewStyle macro has not been updated to use dwExMask. To use the dwExMask value, use the ListView_SetExtendedListViewStyleEx macro.
Version 4.70
LVM_SETHOTCURSOR
wParam = 0;
lParam = (LPARAM)(HCURSOR) hCursor;
Sets the HCURSOR value that the list view control uses when the pointer is over an item while hot tracking is enabled. You can send this message explicitly or use the ListView_SetHotCursor macro.
A list view control uses hot tracking and hover selection when the LVS_EX_TRACKSELECT style is set.
Version 4.70
LVM_SETHOTITEM
wParam = (WPARAM)(INT) iIndex;
lParam = 0;
Sets the hot item for a list view control. You can send this message explicitly or use the ListView_SetHotItem macro.
Version 4.70
LVM_SETHOVERTIME
wParam = 0;
lParam = (LPARAM)(DWORD)dwHoverTime;
Sets the amount of time which the mouse cursor must hover over an item before it is selected. You can send this message explicitly or use the ListView_SetHoverTime macro.
The hover time only affects list view controls that have the LVS_EX_TRACKSELECT, LVS_EX_ONECLICKACTIVATE, or LVS_EX_TWOCLICKACTIVATE extended list view style.
Version 4.71
LVM_SETICONSPACING
wParam = 0;
lParam = (LPARAM) MAKELONG(cx, cy);
Sets the spacing between icons in list view controls that have the LVS_ICON style. You can send this message explicitly or by using the ListView_SetIconSpacing macro.
Values for cx and cy are relative to the upper-left corner of an icon bitmap. Therefore, to set spacing between icons that do not overlap, the cx or cy values must include the size of the icon, plus the amount of empty space desired between icons. Values that do not include the width of the icon will result in overlaps.
Version 4.70
LVM_SETIMAGELIST
wParam = (WPARAM) (int) iImageList;
lParam = (LPARAM) (HIMAGELIST) himl;
Assigns an image list to a list view control. You can send this message explicitly or by using the ListView_SetImageList macro.
| LVSIL_NORMAL | Image list with large icons. |
| LVSIL_SMALL | Image list with small icons. |
| LVSIL_STATE | Image list with state images. |
LVM_SETITEM
wParam = 0;
lParam = (LPARAM) (const LPLVITEM) pitem;
Sets some or all of a list view item's attributes. You can also send LVM_SETITEM to set the text of a subitem. You can send this message explicitly or by using the ListView_SetItem macro.
To set the attributes of a list view item, set the iItem member of the LVITEM structure to the index of the item, and set the iSubItem member to zero. For an item, you can set the state, pszText, iImage, and lParam members of the LVITEM structure.
To set the text of a subitem, set the iItem and iSubItem members to indicate the specific subitem, and use the pszText member to specify the text. Alternatively, you can use the ListView_SetItemText macro to set the text of a subitem. You cannot set the state, iImage, or lParam members for subitems because subitems do not have these attributes.
LVM_SETITEMCOUNT
wParam = (WPARAM) (int) cItems;
lParam = (LPARAM) dwFlags;
Causes the list view control to allocate memory for the specified number of items or sets the virtual number of items in a virtual list view control. This depends on how the list view control was created. You can send this message explicitly or use the ListView_SetItemCount or ListView_SetItemCountEx macros.
| LVSICF_NOINVALIDATEALL | The list view control will not repaint unless affected items are currently in view. |
| LVSICF_NOSCROLL | The list view control will not change the scroll position when the item count changes. |
If the list view control was created without the LVS_OWNERDATA style, sending this message causes the control to allocate its internal data structures for the specified number of items. This prevents the control from having to allocate the data structures every time an item is added.
If the list view control was created with the LVS_OWNERDATA style (a virtual list view), sending this message sets the virtual number of items that the control contains.
The dwFlags parameter is intended only for list view controls that use the LVS_OWNERDATA and LVS_REPORT or LVS_LIST styles.
LVM_SETITEMPOSITION
wParam = (LPARAM) (int) i;
lParam = MAKELPARAM((int) x, (int) y);
Moves an item to a specified position in a list view control (must be in icon or small icon view). You can send this message explicitly or by using the ListView_SetItemPosition macro.
If the list view control has the LVS_AUTOARRANGE style, the items in the list view control are arranged after the position of the item is set.
LVM_SETITEMPOSITION32
wParam = (WPARAM) (int) iItem;
lParam = (LPARAM) (LPPOINT) lpptNewPos;
Moves an item to a specified position in a list view control (must be in icon or small icon view). This message differs from the LVM_SETITEMPOSITION message in that it uses 32-bit coordinates. You can send this message explicitly or by using the ListView_SetItemPosition32 macro.
LVM_SETITEMSTATE
wParam = (WPARAM) (int) i;
lParam = (LPARAM) (LPLVITEM) pitem;
Changes the state of an item in a list view control. You can send this message explicitly or by using the ListView_SetItemState macro.
An item's state value includes a set of bit flags that indicate the item's state. The state value can also include image list indexes that indicate the item's state image and overlay image.
LVM_SETITEMTEXT
wParam = (WPARAM) (int) i;
lParam = (LPARAM) (LPLVITEM) pitem;
Changes the text of a list view item or subitem. You can send this message explicitly or by using the ListView_SetItemText macro.
The pszText member can also be LPSTR_TEXTCALLBACK to indicate a callback item for which the parent window stores the text. In this case, the list view control sends the parent an LVN_GETDISPINFO notification message when it needs the text.
LVM_SETSELECTIONMARK
wParam = 0;
lParam = (LPARAM)(INT) iIndex;
Sets the selection mark in a list view control. You can send this message explicitly or use the ListView_SetSelectionMark macro.
The selection mark is the item index from which a multiple selection starts. This message does not affect the selection state of the item.
Version 4.71
See also LVM_GETSELECTIONMARK
LVM_SETTEXTBKCOLOR
wParam = 0;
lParam = (LPARAM) (COLORREF) clrText;
Sets the background color of text in a list view control. You can send this message explicitly or by using the ListView_SetTextBkColor macro.
LVM_SETTEXTCOLOR
wParam = 0;
lParam = (LPARAM) (COLORREF) clrText;
Sets the text color of a list view control. You can send this message explicitly or by use the ListView_SetTextColor macro.
LVM_SETTOOLTIPS
wParam = 0;
lParam = (LPARAM)(HWND)hwndToolTip;
Sets the tooltip control that the list view control will use to display tooltips. You can send this message explicitly or use the ListView_SetToolTips macro.
See also LVM_GETTOOLTIPS
LVM_SETUNICODEFORMAT
wParam = (WPARAM)(BOOL)fUnicode;
lParam = 0;
Sets the UNICODE character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can send this message explicitly or use the ListView_SetUnicodeFormat macro.
See also LVM_GETUNICODEFORMAT
LVM_SETWORKAREAS
wParam = (WPARAM)(INT) nWorkAreas;
lParam = (LPARAM)(LPRECT) lprc;
Sets the working areas within a list view control. You can send this message explicitly or use the ListView_SetWorkAreas macro.
Version 4.71
LVM_SORTITEMS
wParam = (WPARAM) (LPARAM) lParamSort;
lParam = (LPARAM) (PFNLVCOMPARE) pfnCompare;
Uses an application-defined comparison function to sort the items of a list view control. The index of each item changes to reflect the new sequence. You can send this message explicitly or by using the ListView_SortItems macro.
The comparison function has the following form:
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
The lParam1 parameter is the 32-bit value associated with the first item being compared, and the lParam2 parameter is the value associated with the second item. These are the values that were specified in the lParam member of the items' LVITEM structure when they were inserted into the list. The lParamSort parameter is the same value passed to the LVM_SORTITEMS message.
The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent.
LVM_SUBITEMHITTEST
wParam = 0;
lParam = (LPARAM)(LVHITTESTINFO FAR *)pInfo;
Determines which list view item or subitem is at a given position. You can send this message explicitly or by using the ListView_SubItemHitTest macro.
Version 4.70
LVM_UPDATE
wParam = (WPARAM) iItem;
lParam = 0;
Updates a list view item. If the list view control has the LVS_AUTOARRANGE style, this macro causes the list view control to be arranged. You can send this message explicitly or by using the ListView_Update macro.
This section contains information about the macros used with list view control messages.
DWORD ListView_ApproximateViewRect(
hwndLV,
cx,
cy,
iCount
);
Calculates the approximate width and height required to display a given number of items. You can use this macro or send the LVM_APPROXIMATEVIEWRECT message explicitly.
Version 4.70
BOOL ListView_Arrange(
HWND hwnd,
UINT code
);
Arranges items in icon view. You can use this macro or send the LVM_ARRANGE message explicitly.
| LVA_ALIGNLEFT | Aligns items along the left edge of the window. |
| LVA_ALIGNTOP | Aligns items along the top edge of the window. |
| LVA_DEFAULT | Aligns items according to the list view control's current alignment styles (the default value). |
| LVA_SNAPTOGRID | Snaps all icons to the nearest grid position. |
HIMAGELIST ListView_CreateDragImage(
HWND hwnd,
int iItem,
LPPOINT lpptUpLeft
);
Creates a drag image list for the specified item. You can use this macro or send the LVM_CREATEDRAGIMAGE message explicitly.
BOOL ListView_DeleteAllItems(
HWND hwnd
);
Removes all items from a list view control. You can use this macro or send the LVM_DELETEALLITEMS message explicitly.
When a list view control receives the LVM_DELETEALLITEMS message, it sends the LVN_DELETEALLITEMS notification message to its parent window.
BOOL ListView_DeleteColumn(
HWND hwnd,
int iCol
);
Removes a column from a list view control. You can use this macro or send the LVM_DELETECOLUMN message explicitly.
BOOL ListView_DeleteItem(
HWND hwnd,
int iItem
);
Removes an item from a list view control. You can use this macro or send the LVM_DELETEITEM message explicitly.
HWND ListView_EditLabel(
HWND hwnd,
int iItem
);
Begins in-place editing of the specified list view item's text. The message implicitly selects and focuses the specified item. You can use this macro or send the LVM_EDITLABEL message explicitly.
When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid. You can safely subclass the edit control, but you should not destroy it.
The control must have the focus before you send this message to the control. Focus can be set using the SetFocus function.
See also WM_CANCELMODE
BOOL ListView_EnsureVisible(
HWND hwnd,
int i,
BOOL fPartialOK
);
Ensures that a list view item is either entirely or partially visible, scrolling the list view control if necessary. You can use this macro or send the LVM_ENSUREVISIBLE message explicitly.
int ListView_FindItem(
HWND hwnd,
int iStart,
const LPLVFINDINFO plvfi
);
Searches for a list view item with the specified characteristics. You can use this macro or send the LVM_FINDITEM message explicitly.
COLORREF ListView_GetBkColor(
HWND hwnd
);
Retrieves the background color of a list view control. You can use this macro or send the LVM_GETBKCOLOR message explicitly.
BOOL ListView_GetBkImage(
HWND hwndLV,
LPLVBKIMAGE plvbki
);
Retrieves the background image in a list view control. You can use this macro or send the LVM_GETBKIMAGE message explicitly.
Version 4.71
See also ListView_SetBkImage
UINT ListView_GetCallbackMask(
HWND hwnd
);
Retrieves the callback mask for a list view control. You can use this macro or send the LVM_GETCALLBACKMASK message explicitly.
See also LVM_SETCALLBACKMASK
BOOL ListView_GetCheckState(
HWND hwndLV,
UINT iIndex
);
Determines if an item in a list view control is selected. This should be used only for list view controls that have the LVS_EX_CHECKBOXES style.
Version 4.70
BOOL ListView_GetColumn(
HWND hwnd,
int iCol,
LPLVCOLUMN pcol
);
Retrieves the attributes of a list view control's column. You can use this macro or send the LVM_GETCOLUMN message explicitly.
BOOL ListView_GetColumnOrderArray(
HWND hwndLV,
int iCount,
int *lpiArray
);
Retrieves the current left-to-right order of columns in a list view control. You can use this macro or send the LVM_GETCOLUMNORDERARRAY message explicitly.
Version 4.70
int ListView_GetColumnWidth(
HWND hwnd,
int iCol
);
Retrieves the width of a column in report or list view. You can use this macro or send the LVM_GETCOLUMNWIDTH message explicitly.
int ListView_GetCountPerPage(
HWND hwnd
);
Calculates the number of items that can fit vertically in the visible area of a list view control when in list or report view. Only fully visible items are counted. You can use this macro or send the LVM_GETCOUNTPERPAGE message explicitly.
HWND ListView_GetEditControl(
HWND hwnd
);
Retrieves the handle to the edit control being used to edit a list view item's text. You can use this macro or send the LVM_GETEDITCONTROL message explicitly.
If no label is being edited, the return value is NULL. The edit control is not created until after the LVN_BEGINLABELEDIT notification message is sent.
When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid. You can safely subclass the edit control, but you should not destroy it. To cancel editing, you can send the list view control a WM_CANCELMODE message.
The list view item being edited is the currently focused itemthat is, the item in the focused state. To find an item based on its state, use the LVM_GETNEXTITEM message.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.