Default Tree-View Controls Message Processing
This section describes the window message processing performed by a tree-view control. Because messages specific to tree-view controls are discussed elsewhere, they are not included here.
Message | Processing performed |
WM_COMMAND | Processes the EN_UPDATE and EN_KILLFOCUS edit control notification messages and forwards all other edit control notifications to the parent window. There is no return value. |
WM_CREATE | Allocates memory and initializes internal data structures. It returns zero if successful or - 1 otherwise. |
WM_DESTROY | Frees all system resources associated with the control. It returns zero. |
WM_ENABLE | Enables or disables the control. |
WM_ERASEBKGND | Erases the window background using the current background color for the tree-view control. It returns TRUE. |
WM_GETDLGCODE | Returns a combination of the DLGC_WANTARROWS and DLGC_WANTCHARS values. |
WM_GETFONT | Returns the handle of the current label font. |
WM_HSCROLL | Scrolls the tree-view control. It returns TRUE if scrolling occurs or FALSE otherwise. |
WM_KEYDOWN | Sends the NM_RETURN notification message when the user presses the ENTER key. It moves the caret when the user presses the direction keys or the PAGE UP, PAGE DOWN, HOME, END, or BACKSPACE key. It scrolls the tree-view control when the user presses the CTRL key in combination with those keys. It sends the TVN_KEYDOWN notification message to the parent window. It returns TRUE if a key is processed or FALSE otherwise. |
WM_KILLFOCUS | Repaints the focused item, if any, and sends an NM_KILLFOCUS notification message to the parent window. |
WM_LBUTTONDBLCLK | Cancels label editing and, if an item was double-clicked, sends the NM_DBLCLK or NM_RDBLCLK notification message to the parent window. If the parent window returns TRUE, the tree-view control toggles the expanded state of the item, sending the parent window the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages. There is no return value. |
WM_LBUTTONDOWN | Toggles the expanded state if the user clicked the button associated with a parent item. If the user clicked an item label, the tree-view control selects and sets the focus to the item. If the user moves the mouse before releasing the mouse button, the tree-view control begins a drag and drop operation. There is no return value. |
WM_PAINT | Paints the invalid region of the tree-view control. It returns zero. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context. |
WM_RBUTTONDOWN | Checks to see if an item was clicked and a drag operation was begun. If the operation has begun, it sends a TVN_BEGINRDRAG notification message to the parent window and highlights the drop target. Otherwise, it sends an NM_RCLICK notification message to the parent window. There is no return value. |
WM_SETFOCUS | Repaints the focused item, if any, and sends an NM_SETFOCUS notification message to the parent window. |
WM_SETFONT | Saves the specified font handle and repaints the tree-view control using the new font. |
WM_SETREDRAW | Sets or clears the redraw flag. The tree-view control is redrawn after the redraw flag is set. It returns zero. |
WM_SIZE | Recomputes internal variables that depend on the size of the tree-view control's client area. It returns TRUE. |
WM_STYLECHANGED | Cancels label editing and redraws the tree-view control using the new styles. It returns zero. |
WM_SYSCOLORCHANGE | Redraws the tree-view control using the new color if the redraw flag is set. There is no return value. |
WM_TIMER | Begins editing an item label. If the user clicks the label of the focused item, the tree-view control sets a timer instead of entering edit mode immediately. The timer makes it possible for the tree view to avoid entering edit mode if the user double-clicks the label. It returns zero. |
WM_VSCROLL | Scrolls the tree-view control. It returns TRUE if scrolling occurs or FALSE otherwise. |