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.

MessageProcessing performed
WM_CHARSearches 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_COMMANDProcesses the EN_UPDATE and EN_KILLFOCUS notification codes and forwards all other edit control notifications to the parent window.
WM_CREATEPerforms 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_DESTROYFrees resources allocated during WM_CREATE.
WM_ERASEBKGNDErases 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_GETDLGCODEReturns a combination of the DLGC_WANTTAB and DLGC_WANTARROWS values.
WM_GETFONTReturns the handle to the current label font.
WM_HSCROLLScrolls the list-view control horizontally.
WM_KEYDOWNProcesses the SPACEBAR, ENTER, and arrow keys and sends an LVN_KEYDOWN notification code to the parent window.
WM_KILLFOCUSRepaints the focused list item, if any, and sends an NM_KILLFOCUS notification code to the parent window.
WM_LBUTTONDBLCLKSends the parent window an NM_DBLCLK (list view) notification code.
WM_LBUTTONDOWNProcessed 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_NCCREATEAllocates and initializes an internal data structure and then calls the DefWindowProc function.
WM_NCDESTROYFrees 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_NOTIFYProcesses header control notification codes.
WM_PAINTDisplays 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_RBUTTONDOWNProcessed 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_SETFOCUSRepaints the focused list item, if any, and sends an NM_SETFOCUS notification code to the parent window.
WM_SETFONTSaves the specified font handle, forwards the message to the header window, if any, and repaints using the new font.
WM_SETREDRAWTurns redrawing on or off.
WM_TIMERBegins 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_VSCROLLScrolls the list-view control vertically.
WM_WINDOWPOSCHANGEDUpdates 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_WININICHANGEProcesses changes to system metrics.

 

 

 

Community Additions

ADD
Show:
© 2014 Microsoft