TreeView_Expand

This macro expands or collapses the list of child items, if any, associated with the specified parent item. You can use this macro or send the TVM_EXPAND message explicitly.

At a Glance

Header file: Commctrl.h
Windows CE versions: 1.0 and later
Related message: TVM_EXPAND

Syntax

BOOL TreeView_Expand( hwnd, hitem, flag);

Parameters

hwndTV

Handle to a tree view control.

hItem

Handle to the parent item that will be expanded or collapsed.

flag

Action flag. For a list of possible values, see the description of the flag parameter in TVM_EXPAND.

Value Description
TVE_EXPANDPARTIAL Child items are visible and parent item’s plus symbol is displayed. This flag must be used in combination with the TVE_EXPAND flag.

Return Values

Nonzero indicates that a change took place. Zero indicates otherwise.

Remarks

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.