Default Window-Message Processing
The window procedure for the predefined list box window class carries out default processing for all messages that the list box does not process. When the list box procedure returns FALSE for a message, the predefined window procedure checks the message and performs default actions, as shown in the following table.
Message | Default action |
WM_CHAR | Moves the selection to the first item that begins with the character the user typed. If the list box has the LBS_OWNERDRAW style, no action occurs.
Multiple characters typed within a short interval are treated as a group, and the first item that begins with that series of characters is selected. |
WM_CREATE | Creates an empty list box. |
WM_DESTROY | Destroys the list box and frees any resources it uses. |
WM_DROPFILES | Passes the message to the dialog box procedure or parent window process. |
WM_ENABLE | If the control is visible, invalidates the rectangle so the strings can be painted gray. |
WM_ERASEBKGND | Erases the background of a list box. If the list box has the LBS_OWNERDRAW style, the background is not erased. |
WM_GETDLGCODE | Returns DLGC_WANTARROWS | DLGC_WANTCHARS, indicating the default list box procedure processes the arrow keys and WM_CHAR messages. |
WM_GETFONT | Returns a handle of the current font for the list box. |
WM_HSCROLL | Scrolls the list box horizontally. |
WM_KEYDOWN | Processes virtual keys for scrolling. The virtual key is the index of the item to move the caret to. The selection is not changed. |
WM_KILLFOCUS | Turns the caret off and destroys it. Sends an LBN_KILLFOCUS notification message to the owner of the list box. |
WM_LBUTTONDBLCLK | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area. |
WM_LBUTTONDOWN | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area. |
WM_LBUTTONUP | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area. |
WM_MOUSEMOVE | Tracks the mouse in the list box client area. This enables the user to cancel a selection if the mouse button is released outside the list box client area. |
WM_PAINT | Performs a subclassed paint operation by using the list box handle of the device context (DC). |
WM_SETFOCUS | Turns the caret on and sends an LBN_SETFOCUS notification message to the owner of the list box. |
WM_SETFONT | Sets a new font for the list box. |
WM_SETREDRAW | Sets or clears the redraw flag based on the value of wParam. |
WM_SIZE | Resizes the list box to an integral number of items. |
WM_VSCROLL | Scrolls the list box vertically. |
The predefined list box procedure passes all other messages to DefWindowProc for default processing.