CTreeCtrl::InsertItem

HTREEITEM InsertItem( LPTVINSERTSTRUCT lpInsertStruct );

HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter );

HTREEITEM InsertItem( LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST );

HTREEITEM InsertItem( LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);

Return Value

Handle of the new item if successful; otherwise NULL.

Parameters

lpInsertStruct

A pointer to a TVINSERTSTRUCT that specifies the attributes of the tree view item to be inserted.

nMask

Integer specifying which attributes to set. See the TVITEM structure in the Platform SDK.

lpszItem

Address of a string containing the item’s text.

nImage

Index of the item’s image in the tree view control’s image list.

nSelectedImage

Index of the item’s selected image in the tree view control’s image list.

nState

Specifies values for the item’s states. See Tree View Control Item States in the Platform SDK for a list of appropriate states.

nStateMask

Specifies which states are to be set. See the TVITEM structure in the Platform SDK.

lParam

A 32-bit application-specific value associated with the item.

hParent

Handle of the inserted item’s parent.

hInsertAfter

 Handle of the item after which the new item is to be inserted.

Remarks

Call this function to insert a new item in a tree view control.

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::DeleteItem, CTreeCtrl::HitTest, CTreeCtrl::SelectDropTarget, CTreeCtrl::GetItem, Tree View Control Reference in the Platform SDK