Node Object Property: AllChildren 

Purpose

Returns a collection object containing all descendants for a node.

Return Value

type Collection

Description

The Allchildren property returns a collection object. This property stands for an IEnumVARIANT interface that lets the control user reference the descendants of the node, regardless of whether the node is expanded, enabled, visible, or hidden.

Dim Node As Object

Set Node = Tree.Nodes.Item(1);

for each node in Node.AllChildren

node.Type = node.Type and not NodeTypeHidden

next node

C++ :

LPENUMVARIANT lpEnum;

HRESULT hr;

hr = pNode->QueryInterface(IID_IEnumVARIANT,(LPVOID FAR *)& lpEnum);

if (SUCCEEDED(hr))

{

VARIANT vaChildNode;

lpEnum->Reset();

while (hr == NOERROR)

{

VariantInit(&vaChildNode);

hr = lpEnum->Next(1,&vaChildNode,NULL);

if (hr == NOERROR)

{

hr = VariantChangeType(&vaChildNode,

&vaChildNode,VARIANT_NOPROPVALUE,VT_DISPATCH);

if (SUCCEEDED(hr))

{

LPDISPATCH lpChildNode;

lpChildNode = V_DISPATCH(&vaChildNode);

// work on the automation interface

...

}

VariantClear(&vaChildNode);

}

}

lpEnum->Releas();

}