Default List-View Message Processing
This section lists the window message processing performed by a list-view control.
Message Processing
The following table describes the window message processing performed by a list-view control.
Message | Processing performed |
---|---|
WM_CHAR | Searches for a list-view item that begins with the specified character and, if the item is found, selects and sets the focus to the item. Multiple characters received within a time-out interval, currently fixed at one second, are concatenated, and the list-view control searches for an item that begins with the resulting string. |
WM_COMMAND | Processes the EN_UPDATE and EN_KILLFOCUS notification codes and forwards all other edit control notifications to the parent window. |
WM_CREATE | Performs initialization additional to WM_NCCREATE. If the LVS_SHAREIMAGELISTS window style is not specified, the list-view control creates the icon and small icon image lists at this point. |
WM_DESTROY | Frees resources allocated during WM_CREATE. |
WM_ERASEBKGND | Erases the window background using the current background color for the list-view control. If the background color is the CLR_NONE value, the list-view control forwards the message to the parent window. |
WM_GETDLGCODE | Returns a combination of the DLGC_WANTTAB and DLGC_WANTARROWS values. |
WM_GETFONT | Returns the handle to the current label font. |
WM_HSCROLL | Scrolls the list-view control horizontally. |
WM_KEYDOWN | Processes the SPACEBAR, ENTER, and arrow keys and sends an LVN_KEYDOWN notification code to the parent window. |
WM_KILLFOCUS | Repaints the focused list item, if any, and sends an NM_KILLFOCUS notification code to the parent window. |
WM_LBUTTONDBLCLK | Sends the parent window an NM_DBLCLK (list view) notification code. |
WM_LBUTTONDOWN | Processed in different ways depending on whether a click or drag operation is being initiated. To determine which operation is involved, the list-view control enters a modal message loop until either the button is released or the mouse is moved. In the case of a click, the list-view control might change which item has the focus and which items are selected, taking into account the cursor position, the state of the SHIFT and CTRL keys, and so on. Then the list-view control sends its parent window an NM_CLICK (list view) notification code. If dragging begins over an item, the list-view control selects and sets the focus to the item. Then it sends an LVN_BEGINDRAG notification code to the parent window. The parent window is responsible for actually carrying out the drag operation. If dragging begins over the window background, the list-view control enters another modal message loop, enabling the user to form a rectangle by dragging the mouse. Items within the rectangle are selected. |
WM_NCCREATE | Allocates and initializes an internal data structure and then calls the DefWindowProc function. |
WM_NCDESTROY | Frees resources allocated by the list-view control. Unless the LVS_SHAREIMAGELISTS style is used, this includes deleting the full-sized and small image lists. |
WM_NOTIFY | Processes header control notification codes. |
WM_PAINT | Displays any items in the update region. For callback items, the control first sends an LVN_GETDISPINFO notification code to the owner window to request display information. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context. |
WM_RBUTTONDOWN | Processed the same way as the WM_LBUTTONDOWN message, except that the control sends an NM_RCLICK (list view) notification code (instead of NM_CLICK (list view)) and an LVN_BEGINRDRAG notification code (instead of LVN_BEGINDRAG). Note that the control processes the corresponding WM_RBUTTONUP message, and does not dispatch it. Applications thus cannot see this message, even by subclassing the control. |
WM_SETFOCUS | Repaints the focused list item, if any, and sends an NM_SETFOCUS notification code to the parent window. |
WM_SETFONT | Saves the specified font handle, forwards the message to the header window, if any, and repaints using the new font. |
WM_SETREDRAW | Turns redrawing on or off. |
WM_TIMER | Begins editing of an item label. If the user clicks the label of the focused item, the list-view control sets a timer instead of entering edit mode immediately. The timer makes it possible for the list-view control to not enter edit mode if the user double-clicks the label. |
WM_VSCROLL | Scrolls the list-view control vertically. |
WM_WINDOWPOSCHANGED | Updates the window scroll bars. If the current view is icon or small icon view, and the LVS_AUTOARRANGE style is specified, the list-view control will also arrange the list items. |
WM_WININICHANGE | Processes changes to system metrics. |