HTREEITEM CMyTree::DelChild( HTREEITEM hItem )
{
HTREEITEM hPare = NULL;
if( !ItemHasChildren(hItem) )
{
if( m_iCount >= 0 )
m_iCount--; //静态成员变量
hPare = GetParentItem( hItem );
TRACE( "Delete: %s\n", GetItemText( hItem ) );
DeleteItem( hItem );
return ( m_iCount >= 0 ) ? DelChild( hPare ) : NULL;
}
else
{
++m_iCount;
TRACE( "Node:%s\n",GetItemText( hItem ) );
return DelChild( GetNextItem( hItem, TVGN_CHILD ) );
}
}