
TVM_GETNEXTITEM
wParam = (WPARAM) (UINT) flag;
lParam = (LPARAM) (HTREEITEM) hitem;
Retrieves the tree view item that bears the specified relationship to a specified item. You can send this message explicitly, by using the TreeView_GetNextItem macro, or by using one of these related macros:
| TVGN_CARET | Retrieves the currently selected item. You can use the TreeView_GetSelection macro to send this message. |
| TVGN_CHILD | Retrieves the first child item of the item specified by the hitem parameter. You can use the TreeView_GetChild macro to send this message. |
| TVGN_DROPHILITE | Retrieves the item that is the target of a drag-and-drop operation. You can use the TreeView_GetDropHilight macro to send this message. |
| TVGN_FIRSTVISIBLE | Retrieves the first visible item. You can use the TreeView_GetFirstVisible macro to send this message. |
| TVGN_LASTVISIBLE | Version 4.71. Retrieves the last visible item. You can use the TreeView_GetLastVisible macro to send this message. |
| TVGN_NEXT | Retrieves the next sibling item. You can use the TreeView_GetNextSibling macro to send this message. |
| TVGN_NEXTVISIBLE | Retrieves the next visible item that follows the specified item. The specified item must be visible. Use the TVM_GETITEMRECT message to determine whether an item is visible. You can use the TreeView_GetNextVisible macro to send this message. |
| TVGN_PARENT | Retrieves the parent of the specified item. You can use the TreeView_GetParent macro to send this message. |
| TVGN_PREVIOUS | Retrieves the previous sibling item. You can use the TreeView_GetPrevSibling macro to send this message. |
| TVGN_PREVIOUSVISIBLE | Retrieves the first visible item that precedes the specified item. The specified item must be visible. Use the TVM_GETITEMRECT message to determine whether an item is visible. You can use the TreeView_GetPrevVisible macro to send this message. |
| TVGN_ROOT | Retrieves the topmost or very first item of the tree view control. You can use the TreeView_GetRoot macro to send this message. |
TVM_GETSCROLLTIME
wParam = 0;
lParam = 0;
Retrieves the maximum scroll time for the tree view control. You can send this message explicitly or by using the TreeView_GetScrollTime macro.
The maximum scroll time is the longest amount of time that a scroll operation can take. The scrolling will be adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less time than the maximum.
See also TVM_SETSCROLLTIME
TVM_GETTEXTCOLOR
wParam = 0;
lParam = 0;
Retrieves the current text color of the control. You can send this message explicitly or by using the TreeView_GetTextColor macro.
Version 4.71
See also TVM_SETTEXTCOLOR
TVM_GETTOOLTIPS
wParam = 0;
lParam = 0;
Retrieves the handle to the child tooltip control used by a tree view control. You can send this message explicitly or by using the TreeView_GetToolTips macro.
When created, tree view controls automatically create a child tooltip control. To cause a tree view control not to use tooltips, create the control with the TVS_NOTOOLTIPS style.
Version 4.70
See also TVM_SETTOOLTIPS
TVM_GETUNICODEFORMAT
wParam = 0;
lParam = 0;
Retrieves the UNICODE character format flag for the control. You can send this message explicitly or use the TreeView_GetUnicodeFormat macro.
See also TVM_SETUNICODEFORMAT
TVM_GETVISIBLECOUNT
wParam = 0;
lParam = 0;
Obtains the number of items that can be fully visible in the client window of a tree view control. You can send this message explicitly or by using the TreeView_GetVisibleCount macro.
The number of items that can be fully visible may be greater than the number of items in the control. The control calculates this value by dividing the height of the client window by the height of an item.
Note that the return value is the number of items that can be fully visible. If you can see all of 20 items and part of one more item, the return value is 20.
TVM_HITTEST
wParam = 0;
lParam = (LPARAM) (LPTVHITTESTINFO) lpht;
Determines the location of the specified point relative to the client area of a tree view control. You can send this message explicitly or by using the TreeView_HitTest macro.
TVM_INSERTITEM
wParam = 0;
lParam = (LPARAM) (LPTVINSERTSTRUCT) lpis;
Inserts a new item in a tree view control. You can send this message explicitly or by using the TreeView_InsertItem macro.
See also TVN_ENDLABELEDIT
TVM_SELECTITEM
wParam = (WPARAM) flag;
lParam = (LPARAM) (HTREEITEM) hitem;
Selects the specified tree view item, scrolls the item into view, or redraws the item in the style used to indicate the target of a drag-and-drop operation. You can send this message explicitly or by using the TreeView_Select, TreeView_SelectItem, or TreeView_SelectDropTarget macro.
| TVGN_CARET | Sets the selection to the specified item. The tree view control's parent window receives the TVN_SELCHANGING and TVN_SELCHANGED notification messages. |
| TVGN_DROPHILITE | Redraws the specified item in the style used to indicate the target of a drag-and-drop operation. |
| TVGN_FIRSTVISIBLE | Ensures that the specified item is visible, and, if possible, displays it at the top of the control's window. Tree view controls display as many items as will fit in the window. If the specified item is near the bottom of the control's hierarchy of items, it might not become the first visible item, depending on how many items fit in the window. |
If the specified item is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified item. In this case, the control's parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
Using the TreeView_SelectItem macro is equivalent to sending the TVM_SELECTITEM message with flag set to the TVGN_CARET value. Using the TreeView_SelectDropTarget macro is equivalent to sending the TVM_SELECTITEM message with flag set to the TVGN_DROPHILITE value. Using TreeView_SelectSetFirstVisible is equivalent to sending the TVM_SELECTITEM message with flag set to the TVGN_FIRSTVISIBLE value.
TVM_SETBKCOLOR
wParam = 0;
lParam = (LPARAM)(COLORREF) clrBk;
Sets the background color of the control. You can send this message explicitly or by using the TreeView_SetBkColor macro.
Version 4.71
See also TVM_GETBKCOLOR
TVM_SETIMAGELIST
wParam = (WPARAM) iImage;
lParam = (LPARAM) (HIMAGELIST) himl;
Sets the normal or state image list for a tree view control and redraws the control using the new images. You can send this message explicitly or by using the TreeView_SetImageList macro.
| TVSIL_NORMAL | Indicates the normal image list, which contains selected, nonselected, and overlay images for the items of a tree view control. |
| TVSIL_STATE | Indicates the state image list. You can use state images to indicate application-defined item states. A state image is displayed to the left of an item's selected or nonselected image. |
See also TVM_GETIMAGELIST
TVM_SETINDENT
wParam = (WPARAM) indent;
lParam = 0;
Sets the width of indentation for a tree view control and redraws the control to reflect the new width. You can send this message explicitly or by using the TreeView_SetIndent macro.
TVM_SETINSERTMARK
wParam = (WPARAM)(BOOL) fAfter;
lParam = (LPARAM)(HTREEITEM) htiInsert;
Sets the insertion mark in a tree view control. You can send this message explicitly or by using the TreeView_SetInsertMark macro.
Version 4.71
TVM_SETINSERTMARKCOLOR
wParam = 0;
lParam = (LPARAM)(COLORREF)clrInsertMark;
Sets the color used to draw the insertion mark for the tree view. You can send this message explicitly or by using the TreeView_SetInsertMarkColor macro.
Version 4.71
See also TVM_GETINSERTMARKCOLOR
TVM_SETITEM
wParam = 0;
lParam = (LPARAM) (const LPTVITEM) pitem;
Sets some or all of a tree view item's attributes. You can send this message explicitly or by using the TreeView_SetItem macro.
TVM_SETITEMHEIGHT
wParam = (WPARAM)(SHORT) cyItem;
lParam = 0;
Sets the height of the tree view items. You can send this message explicitly or by using the TreeView_SetItemHeight macro.
The tree view control uses this value for the height of all items. To modify the height of individual items, see the description of the iIntegral member of the TVITEMEX structure.
Version 4.71
See also TVM_GETITEMHEIGHT
TVM_SETSCROLLTIME
wParam = (WPARAM)(UINT)uScrollTime;
lParam = 0;
Sets the maximum scroll time for the tree view control. You can send this message explicitly or by using the TreeView_SetScrollTime macro.
The maximum scroll time is the longest amount of time that a scroll operation can take. Scrolling will be adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less time than the maximum.
See also TVM_GETSCROLLTIME
TVM_SETTEXTCOLOR
wParam = 0;
lParam = (LPARAM)(COLORREF) clrText;
Sets the text color of the control. You can send this message explicitly or by using the TreeView_SetTextColor macro.
Version 4.71
See also TVM_GETTEXTCOLOR
TVM_SETTOOLTIPS
wParam = (WPARAM)(HWND) hwndTooltip;
lParam = 0;
Sets a tree view control's child tooltip control. You can send this message explicitly or by using the TreeView_SetToolTips macro.
When created, tree view controls automatically create a child tooltip control. To prevent a tree view control from using tooltips, create the control with the TVS_NOTOOLTIPS style.
Version 4.70
See also TVM_GETTOOLTIPS
TVM_SETUNICODEFORMAT
wParam = (WPARAM)(BOOL)fUnicode;
lParam = 0;
Sets the UNICODE character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can send this message explicitly or use the TreeView_SetUnicodeFormat macro.
See also TVM_GETUNICODEFORMAT
TVM_SORTCHILDREN
wParam = (WPARAM)(BOOL) fRecurse;
lParam = (LPARAM)(HTREEITEM) hitem;
Sorts the child items of the specified parent item in a tree view control. You can send this message explicitly or by using the TreeView_SortChildren macro.
TVM_SORTCHILDRENCB
wParam = (WPARAM)(BOOL) fRecurse;
lParam = (LPARAM) (LPTVSORTCB) psort;
Sorts tree view items using an application-defined callback function that compares the items. You can send this message explicitly or by using the TreeView_SortChildrenCB macro.
This section contains information about the macros that are used with tree view controls.
HIMAGELIST TreeView_CreateDragImage(
HWND hwndTV,
HTREEITEM hitem
);
Creates a dragging bitmap for the specified item in a tree view control. The macro also creates an image list for the bitmap and adds the bitmap to the image list. An application can display the image when dragging the item by using the image list functions. You can use this macro or send the TVM_CREATEDRAGIMAGE message explicitly.
If you create a tree view control without an associated image list, you cannot use the TreeView_CreateDragImage macro to create the image to display during a drag operation. You must implement your own method of creating a drag cursor.
BOOL TreeView_DeleteAllItems(
HWND hwndTV
);
Removes an item from a tree view control. You can use this macro, the TreeView_DeleteItem macro, or send the TVM_DELETEITEM message explicitly.
If the item label is being edited, the edit operation is canceled and the parent window receives the TVN_ENDLABELEDIT notification message. The parent window receives a TVN_DELETEITEM notification message when the item is removed.
BOOL TreeView_DeleteItem(
HWND hwndTV,
HTREEITEM hitem
);
Removes an item from a tree view control. You can use this macro, the TreeView_DeleteAllItems macro, or send the TVM_DELETEITEM message explicitly.
If the item label is being edited, the edit operation is canceled and the parent window receives the TVN_ENDLABELEDIT notification message. The parent window receives a TVN_DELETEITEM notification message when the item is removed.
HWND TreeView_EditLabel( HWND hwndTV, HTREEITEM hitem );
Begins in-place editing of the specified item's text, replacing the text of the item with a single-line edit control containing the text. This macro implicitly selects and focuses the specified item. You can use this macro or send the TVM_EDITLABEL message explicitly.
This macro sends a TVN_BEGINLABELEDIT notification message to the parent of the tree view control.
When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid. You can safely subclass the edit control, but do not destroy it.
The control must have the focus before you call this macro. Focus can be set using the SetFocus function.
BOOL TreeView_EndEditLabelNow(
HWND hwndTV,
BOOL fCancel
);
Ends the editing of a tree view item's label. You can use this macro or send the TVM_ENDEDITLABELNOW message explicitly.
This macro causes the TVN_ENDLABELEDIT notification message to be sent to the parent window of the tree view control.
BOOL TreeView_EnsureVisible( HWND hwndTV, HTREEITEM hitem );
Ensures that a tree view item is visible, expanding the parent item or scrolling the tree view control, if necessary. You can use this macro or send the TVM_ENSUREVISIBLE message explicitly.
If the TreeView_EnsureVisible macro expands the parent item, the parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
BOOL TreeView_Expand(
HWND hwndTV,
HTREEITEM hItem,
UINT flag
);
Expands or collapses the list of child items associated with the specified parent item, if any. You can use this macro or send the TVM_EXPAND message explicitly.
The TreeView_Expand macro will cause the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages to be generated if the item being expanded does not have the TVIS_EXPANDEDONCE state bit set. This state gets set when a parent item is expanded for the first time. Using TVE_COLLAPSE and TVE_COLLAPSERESET with TreeView_Expand will cause the TVIS_EXPANDEDONCE state to be reset.
If the item already has the TVIS_EXPANDEDONCE state set, the TreeView_Expand macro will not cause the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages to be generated.
COLORREF TreeView_GetBkColor(
HWND hwndTV
);
Retrieves the current background color of the control. You can use this macro or send the TVM_GETBKCOLOR message explicitly.
Version 4.71
See also TreeView_SetBkColor
HTREEITEM TreeView_GetChild(
HWND hwndTV,
HTREEITEM hitem,
);
Retrieves the first child item of the specified tree view item. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_CHILD flag.
See also TreeView_GetNextItem, TreeView_GetNextSibling, TreeView_GetParent, TreeView_GetPrevSibling
UINT TreeView_GetCount(
HWND hwndTV
);
Retrieves a count of the items in a tree view control. You can use this macro or send the TVM_GETCOUNT message explicitly.
HTREEITEM TreeView_GetDropHilight(
HWND hwndTV
);
Retrieves the tree view item that is the target of a drag-and-drop operation. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_DROPHILITE flag.
HWND TreeView_GetEditControl(
HWND hwndTV
);
Retrieves the handle to the edit control being used to edit a tree view item's text. You can use this macro or send the TVM_GETEDITCONTROL message explicitly.
HTREEITEM TreeView_GetFirstVisible(
HWND hwndTV
);
Retrieves the first visible item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_FIRSTVISIBLE flag.
See also TreeView_GetNextVisible, TreeView_GetPrevVisible, TreeView_GetLastVisible, TVM_GETITEMRECT
HIMAGELIST TreeView_GetImageList(
HWND hwndTV,
INT iImage
);
Retrieves the handle to the normal or state image list associated with a tree view control. You can use this macro or send the TVM_GETIMAGELIST message explicitly.
| TVSIL_NORMAL | Indicates the normal image list, which contains selected, nonselected, and overlay images for the items of a tree view control. |
| TVSIL_STATE | Indicates the state image list. You can use state images to indicate application-defined item states. A state image is displayed to the left of an item's selected or nonselected image. |
See also TreeView_SetImageList
UINT TreeView_GetIndent(
HWND hwndTV
);
Retrieves the amount, in pixels, that child items are indented relative to their parent items. You can use this macro or send the TVM_GETINDENT message explicitly.
COLORREF TreeView_GetInsertMarkColor(
HWND hwndTV
);
Retrieves the color used to draw the insertion mark for the tree view. You can use this macro or send the TVM_GETINSERTMARKCOLOR message explicitly.
Version 4.71
See also TreeView_SetInsertMarkColor
BOOL TreeView_GetISearchString( HWND hwndTV, LPTSTR lpsz );
Retrieves the incremental search string for a tree view control. The tree view control uses the incremental search string to select an item based on characters typed by the user. You can use this macro or send the TVM_GETISEARCHSTRING message explicitly.
If the tree view control is not in incremental search mode, the return value is zero.
BOOL TreeView_GetItem( HWND hwndTV, LPTVITEM pitem );
Retrieves some or all of a tree view item's attributes. You can use this macro or send the TVM_GETITEM message explicitly.
int TreeView_GetItemHeight(
HWND hwndTV
);
Retrieves the current height of the tree view items. You can use this macro or send the TVM_GETITEMHEIGHT message explicitly.
Version 4.71
See also TreeView_SetItemHeight
BOOL TreeView_GetItemRect( HWND hwndTV, HTREEITEM hitem, LPRECT prc, BOOL fItemRect );
Retrieves the bounding rectangle for a tree view item and indicates whether the item is visible. You can use this macro or send the TVM_GETITEMRECT message explicitly.
HTREEITEM TreeView_GetLastVisible(
HWND hwndTV
);
Retrieves the last visible item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_LASTVISIBLE flag.
Version 4.71.
See also TreeView_GetFirstVisible, TreeView_GetNextVisible, TreeView_GetPrevVisible, TVM_GETITEMRECT
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.