Help Center

CTreeView.InsertSortedItemmethod

Inserts the item into the list in alphabetical order.

WindowsmethodCTreeView.incdocumented

Syntax

FUNCTION InsertSortedItem (BYVAL hTreeView AS HWND, BYVAL hParent AS HTREEITEM, BYVAL pwszText AS WSTRING PTR, BYVAL lParam AS ..LPARAM = 0, BYVAL iImage AS LONG = 0, BYVAL iSelectedImage AS LONG = 0) AS HTREEITEM

Parameters

NameDescription
hTreeViewThe handle of the TreeView control.
hParentHandle to the parent item. If this member is the TVI_ROOT value or NULL, the item is inserted at the root of the tree-view control.
pwszTextPointer to a null-terminated string that contains the item text if the structure specifies item attributes. If this member is the LPSTR_TEXTCALLBACK value, the parent window is responsible for storing the name. In this case, the tree-view control sends the parent window a TVN_GETDISPINFO notification code when it needs the item text for displaying, sorting, or editing and a TVN_SETDISPINFO notification code when the item text changes. If the structure is receiving item attributes, this member is the address of the buffer that receives the item text. Note that although the tree-view control allows any length string to be stored as item text, only the first 260 characters are displayed.
lParamA value to associate with the item.
iImageIndex in the tree-view control's image list of the icon image to use when the item is in the nonselected state. If this member is the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the tree-view control sends the parent a TVN_GETDISPINFO notification code to retrieve the index when it needs to display the image.
iSelectedImageIndex in the tree-view control's image list of the icon image to use when the item is in the selected state. If this member is the I_IMAGECALLBACK value, the parent window is responsible for storing the index. In this case, the tree-view control sends the parent a TVN_GETDISPINFO notification code to retrieve the index when it needs to display the image.

Return value

Returns the HTREEITEM handle to the new item if successful, or NULL otherwise.

Description

Inserts the item into the list in alphabetical order.

Reference

  • Include file CTreeView.inc
  • Defined in AfxNova/CTreeView.inc:290
  • Documented in Windows/WIndows Controls/CTreeView Class.md
  • Topic: CTreeView Class