Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

TVM_EXPAND 
wParam = (WPARAM)(UINT) 
flag; 

lParam = (LPARAM)(HTREEITEM) 
hitem;

Parameters

flag

Action flag. It is one or more of the following values.

Value Description

TVE_COLLAPSE

Collapses the list.

TVE_COLLAPSERESET

Collapses the list and removes the child items. This flag must be used with the TVE_COLLAPSE flag.

TVE_EXPAND

Expands the list.

TVE_EXPANDPARTIAL

Partially expands the list. In this state, the child items are visible and the parent item's plus symbol is displayed. This flag must be used in combination with the TVE_EXPAND flag. TVE_EXPANDPARTIAL is supported for Windows CE 2.0 and later.

TVE_TOGGLE

Collapses the list if it is expanded or expands it if it is collapsed.

hitem

Handle to the parent item to expand or collapse.

Return Value

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

Remarks

When the TVE_EXPANDPARTIAL flag is set, the child items are visible and the plus (+) for the parent item is displayed. This flag must be used in combination with the TVE_EXPAND flag.

The TVM_EXPAND message will cause the TVN_ITEMEXPANDINGand TVN_ITEMEXPANDEDmessages 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 TVM_EXPAND will cause the TVIS_EXPANDEDONCE state to be reset.

Requirements

Header commctrl.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also