Share via


List Box Messages

The following table shows the list box messages, with a description of the purpose of each.

Programming element Description
LB_ADDSTRING This message is sent by an application to add a string to a list box.
LB_DELETESTRING This message is sent by an application to delete a string in a list box.
LB_FINDSTRING This message is sent by an application to find the first string in a list box that contains the specified prefix.
LB_FINDSTRINGEXACT This message is sent by an application to find the first list box string that matches the string specified in the lpszFind parameter.
LB_GETANCHORINDEX This message is sent by an application to retrieve the index of the anchor item.
LB_GETCARETINDEX This message is sent by an application to determine the index of the item that has the focus rectangle in a multiple-selection list box.
LB_GETCOUNT This message is sent by an application to retrieve the number of items in a list box.
LB_GETCURSEL This message is sent by an application to retrieve the index of the currently selected item, if any, in a single-selection list box.
LB_GETHORIZONTALEXTENT This message is sent by an application to retrieve from a list box the width, in pixels, by which the list box can be scrolled horizontally — the scrollable width — if the list box has a horizontal scroll bar.
LB_GETITEMDATA This message is sent by an application to retrieve the application-defined 32-bit value associated with the specified list box item.
LB_GETITEMHEIGHT This message is sent by an application to retrieve the height of items in a list box.
LB_GETITEMRECT This message is sent by an application to retrieve the dimensions of the rectangle that bounds a list box item as it is currently displayed in the list box.
LB_GETLOCALE This message is sent by an application to retrieve the current locale of the list box.
LB_GETSEL This message is sent by an application to retrieve the selection state of an item.
LB_GETSELCOUNT This message is sent by an application to retrieve the total number of selected items in a multiple-selection list box.
LB_GETSELITEMS This message is sent by an application to fill a buffer with an array of integers that specify the item numbers of selected items in a multiple-selection list box.
LB_GETTEXT This message is sent by an application to retrieve a string from a list box.
LB_GETTEXTLEN This message is sent by an application to retrieve the length of a string in a list box.
LB_GETTOPINDEX This message is sent by an application to retrieve the index of the first visible item in a list box.
LB_INITSTORAGE This message allocates memory for storing list box items.
LB_INSERTSTRING This message is sent by an application to insert a string into a list box.
LB_ITEMFROMPOINT This message is sent by an application to retrieve the zero-based index of the item nearest the specified point in a list box.
LB_RESETCONTENT This message is sent by an application to remove all items from a list box.
LB_SELECTSTRING This message is sent by an application to search a list box for an item that begins with the characters in a specified string.
LB_SELITEMRANGE This message is sent by an application to select one or more consecutive items in a multiple-selection list box.
LB_SELITEMRANGEEX This message is sent by an application to select one or more consecutive items in a multiple-selection list box.
LB_SETANCHORINDEX This message is sent by an application to set the position of the anchor item.
LB_SETCARETINDEX This message is sent by an application to set the focus rectangle to the item at the specified index in a multiple-selection list box.
LB_SETCOLUMNWIDTH This message is sent by an application to a multiple-column list box — created with the LBS_MULTICOLUMN style — to set the width, in pixels, of all columns in the list box.
LB_SETCURSEL This message is sent by an application to select a string and scroll it into view, if necessary.
LB_SETHORIZONTALEXTENT This message is sent by an application to set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width).
LB_SETITEMDATA This message is sent by an application to set a 32-bit value associated with the specified item in a list box.
LB_SETITEMHEIGHT This message is sent by an application to set the height, in pixels, of items in a list box.
LB_SETLOCALE This message is sent by an application to set the current locale of the list box.
LB_SETSEL This message is sent by an application to select a string in a multiple-selection list box.
LB_SETTABSTOPS This message is sent by an application to set the tab-stop positions in a list box.
LB_SETTOPINDEX This message is sent by an application to ensure that a particular item in a list box is visible.
LBN_DBLCLK This message is sent by an application when the user double-clicks a string in a list box.
LBN_ERRSPACE This message is sent by an application when a list box cannot allocate enough memory to meet a specific request.
LBN_KILLFOCUS This message is sent by an application when a list box loses the keyboard focus.
LBN_SELCANCEL This message is sent by an application when the user cancels the selection in a list box.
LBN_SELCHANGE This message is sent by an application when the selection in a list box is about to change.
LBN_SETFOCUS This message is sent by an application when a list box receives the keyboard focus.
WM_CTLCOLORLISTBOX This message is sent to the parent window of a list box before Windows draws the list box.
WM_DELETEITEM This message is sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message.

See Also

List Box Reference

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.