The following table lists all the messages handled by the predefined list-box window-class procedure.
┌─────────────────────────┬───────────────────────────────────┐ │Message │Description │ ├─────────────────────────┼───────────────────────────────────┤ │LM_DELETEALL │Deletes all items in the list. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_DELETEITEM │Removes the specified item from the│ │ │list, redrawing the list as │ │ │necessary. Returns the number of │ │ │items remaining in the list. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_INSERTITEM │Inserts a new item into the list │ │ │according to the position │ │ │information passed with the │ │ │message. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_INSERTMULTITEMS │Inserts one or more items into a │ │ │list box at one time. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYITEMCOUNT │Returns the number of items in the │ │ │list. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYITEMHANDLE │Returns the specified item handle. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYITEMTEXT │Copies the text of the specified │ │ │item to a buffer supplied by the │ │ │message sender. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYITEMTEXTLENGTH │Returns the text length of the │ │ │specified item. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYSELECTION │For a single-selection list box, │ │ │returns the zero-based index of the│ │ │currently selected item. For a │ │ │multiple-selection list box, │ │ │returns the next selected item or │ │ │LIT_NONE if no more items are │ │ │selected. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_QUERYTOPINDEX │Returns the zero-based index to the│ │ │item currently visible at the top │ │ │of the list. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SEARCHSTRING │Searches the list for a match to │ │ │the specified string. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SELECTITEM │Selects the specified item. If the│ │ │list is a single-selection list, │ │ │deselects the previous selection. │ │ │Sends a WM_CONTROL message (with │ │ │the LN_SELECT code) to the owner │ │ │window. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SETITEMHANDLE │Sets the specified item handle. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SETITEMHEIGHT │Sets the item height for the list. │ │ │All items in the list have the same│ │ │height. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SETITEMTEXT │Sets the text for the specified │ │ │item. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SETITEMWIDTH │Sets the maximum width of a list │ │ │box created with the LS_HORZSCROLL │ │ │style. │ ├─────────────────────────┼───────────────────────────────────┤ │LM_SETTOPINDEX │Shows the specified item as the top│ │ │item in the list window, scrolling │ │ │the list as necessary. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_ADJUSTWINDOWPOS │If the list box has the style │ │ │LS_NOADJUSTPOS, makes no changes to│ │ │the SWP structure and returns │ │ │FALSE. Otherwise, adjusts the │ │ │height of the list box so that a │ │ │partial item is not shown at the │ │ │bottom of the list. Returns TRUE │ │ │if the SWP structure is changed. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_BUTTON2DOWN │Returns TRUE; the message is │ │ │ignored. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_BUTTON3DOWN │Returns TRUE; the message is │ │ │ignored. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_CHAR │Processes virtual keys for line and│ │ │page scrolling. Sends an LN_ENTER │ │ │notification code for the Enter │ │ │key. Returns TRUE if the key is │ │ │processed; otherwise, passes the │ │ │message to the WinDefWindowProc │ │ │function. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_CREATE │Creates an empty list box with a │ │ │scroll bar. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_DESTROY │Destroys the list and deallocates │ │ │any memory allocated during its │ │ │existence. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_ENABLE │Enables the scroll bar if there are│ │ │more items than can be displayed in│ │ │a list-box window. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_MOUSEMOVE │Sets the mouse pointer to the arrow│ │ │shape and returns TRUE to show that│ │ │the message was processed. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_PAINT │Draws the list box and its items. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_HSCROLL │Handles scrolling indicated by the │ │ │list-box horizontal scroll bar. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_VSCROLL │Handles scrolling indicated by the │ │ │list-box vertical scroll bar. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_SETFOCUS │If the list box is gaining the │ │ │focus, creates a cursor and sends │ │ │an LN_SETFOCUS notification code to│ │ │the owner window. If the list box │ │ │is losing the focus, this message │ │ │destroys the cursor and sends an │ │ │LN_KILLFOCUS notification code to │ │ │the owner window. │ ├─────────────────────────┼───────────────────────────────────┤ │WM_TIMER │Uses timers to control automatic │ │ │scrolling that occurs when a user │ │ │drags the mouse pointer outside the│ │ │window. │ └─────────────────────────┴───────────────────────────────────┘