Upravit

Sdílet prostřednictvím


List Box

This section contains information about the programming elements used with list boxes. A list box is a control window that contains a simple list of items from which the user can choose. For more complex lists, use the List View instead.

Overviews

Topic Contents
About List Boxes Describes list box features.
Using List Boxes Explains how to perform tasks associated with list boxes.

Functions

Topic Contents
DlgDirList Replaces the contents of a list box with the names of the subdirectories and files in a specified directory.
DlgDirSelectEx Retrieves the current selection from a single-selection list box.
DrawInsert Draws the insert icon in the parent window of the specified drag list box.
GetListBoxInfo Retrieves information about the specified list box.
LBItemFromPt Retrieves the index of the item at the specified point in a list box.
MakeDragList Changes the specified single-selection list box to a drag list box.

Messages

Topic Contents
LB_ADDFILE Adds the specified file name to a list box that contains a directory listing.
LB_ADDSTRING Adds a string to a list box.
LB_DELETESTRING Deletes a string in a list box.
LB_DIR Adds names to the list displayed by a list box.
LB_FINDSTRING Finds the first string in a list box that begins with the specified string.
LB_FINDSTRINGEXACT Finds the first list box string that exactly matches the specified string, except that the search is not case sensitive.
LB_GETANCHORINDEX Gets the index of the anchor item that is, the item from which a multiple selection starts.
LB_GETCARETINDEX Retrieves the index of the item that has the focus rectangle in a multiple-selection list box. The item may or may not be selected.
LB_GETCOUNT Gets the number of items in a list box.
LB_GETCURSEL Gets the index of the currently selected item, if any, in a single-selection list box.
LB_GETHORIZONTALEXTENT Gets the width, in pixels, that a list box can be scrolled horizontally (the scrollable width) if the list box has a horizontal scroll bar.
LB_GETITEMDATA Gets the application-defined value associated with the specified list box item.
LB_GETITEMHEIGHT Gets the height of items in a list box.
LB_GETITEMRECT Gets the dimensions of the rectangle that bounds a list box item as it is currently displayed in the list box.
LB_GETLISTBOXINFO Gets the number of items per column in a specified list box.
LB_GETLOCALE Gets the current locale of the list box.
LB_GETSEL Gets the selection state of an item.
LB_GETSELCOUNT Gets the total number of selected items in a multiple-selection list box.
LB_GETSELITEMS Fills a buffer with an array of integers that specify the item numbers of selected items in a multiple-selection list box.
LB_GETTEXT Gets a string from a list box.
LB_GETTEXTLEN Gets the length of a string in a list box.
LB_GETTOPINDEX Gets the index of the first visible item in a list box.
LB_INITSTORAGE Allocates memory for storing list box items. This message is used before an application adds a large number of items to a list box.
LB_INSERTSTRING Inserts a string or item data into a list box. Unlike the LB_ADDSTRING message, the LB_INSERTSTRING message does not cause a list with the LBS_SORT style to be sorted.
LB_ITEMFROMPOINT Gets the zero-based index of the item nearest the specified point in a list box.
LB_RESETCONTENT Removes all items from a list box.
LB_SELECTSTRING Searches a list box for an item that begins with the characters in a specified string.
LB_SELITEMRANGE Selects or deselects one or more consecutive items in a multiple-selection list box.
LB_SELITEMRANGEEX Selects one or more consecutive items in a multiple-selection list box.
LB_SETANCHORINDEX Sets the anchor item that is, the item from which a multiple selection starts. A multiple selection spans all items from the anchor item to the caret item.
LB_SETCARETINDEX Sets the focus rectangle to the item at the specified index in a multiple-selection list box. If the item is not visible, it is scrolled into view.
LB_SETCOLUMNWIDTH Sets the width, in pixels, of all columns in a multiple-column list box.
LB_SETCOUNT Sets the count of items in a list box created with the LBS_NODATA style and not created with the LBS_HASSTRINGS style.
LB_SETCURSEL Selects a string and scrolls it into view, if necessary.
LB_SETHORIZONTALEXTENT Sets the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width).
LB_SETITEMDATA Sets a value that is associated with the specified item in a list box.
LB_SETITEMHEIGHT Sets the height, in pixels, of items in a list box.
LB_SETLOCALE Sets the current locale of the list box.
LB_SETSEL Selects a string in a multiple-selection list box.
LB_SETTABSTOPS Sets the tab-stop positions in a list box.
LB_SETTOPINDEX Ensures that the specified item in a list box is visible.

Notifications

Topic Contents
LBN_DBLCLK Notifies the application that the user has double-clicked an item in a list box.
LBN_ERRSPACE Notifies the application that the list box cannot allocate enough memory to meet a specific request.
LBN_KILLFOCUS Notifies the application that the list box has lost the keyboard focus.
LBN_SELCANCEL Notifies the application that the user has canceled the selection in a list box.
LBN_SELCHANGE Notifies the application that the selection in a list box has changed.
LBN_SETFOCUS Notifies the application that the list box has received the keyboard focus.
WM_CHARTOITEM Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.
WM_CTLCOLORLISTBOX Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.
WM_DELETEITEM 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.
WM_VKEYTOITEM Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.
DL_BEGINDRAG Notifies the drag list box's parent window that the user has clicked the left mouse button on an item.
DL_CANCELDRAG Signals that the user has canceled a drag operation by clicking the right mouse button or pressing the ESC key.
DL_DRAGGING Signals that the user has moved the mouse while dragging an item.
DL_DROPPED Signals that the user has completed a drag operation by releasing the left mouse button.

Structures

Topic Contents
DELETEITEMSTRUCT Contains information about a deleted list box or combo box item.
DRAGLISTINFO Contains information about a drag event. The pointer to DRAGLISTINFO is passed as the lParam parameter of the drag list message.

Constants

Topic Contents
List Box Styles Describes the window styles that define a list box control.