2009/09/30

CTreeCtrl 탐색하기

별 것 아니지만 안쓰면 자꾸 잊어버린다.


TCHAR szItem[256];

TVITEM tvItem;
tvItem.cchTextMax = 256;
tvItem.pszText = szItem;
tvItem.mask = TVIF_TEXT | TVIF_HANDLE;

HTREEITEM hItem = m_ctrlTree.GetRootItem();

while ( hItem )
{
tvItem.hItem = hItem;
m_ctrlTree.GetItem( &tvItem );

TRACE( _T("%s\n"), tvItem.pszText );

if ( m_ctrlTree.ItemHasChildren( hItem ) )
{
HTREEITEM hSubItem = m_ctrlTree.GetChildItem( hItem );

while ( hSubItem )
{
tvItem.hItem = hSubItem;
m_ctrlTree.GetItem( &tvItem );

TRACE( _T("--- %s\n"), tvItem.pszText );

hSubItem = m_ctrlTree.GetNextSiblingItem( hSubItem );
}
}

hItem = m_ctrlTree.GetNextSiblingItem( hItem );
}


Original Post : http://neodreamer-dev.tistory.com/329

No comments :

Post a Comment