rendered paste bodyHTREEITEM CawnnDlg::GetNthItem(int n)
{
return __GetNthItem(n, m_tree.GetRootItem());
}
HTREEITEM CawknnDlg::__GetNthItem(int &step, HTREEITEM hdl)
{
CString x = m_tree.GetItemText(hdl);
if (--step <= 0)
return hdl;
HTREEITEM child = m_tree.GetNextItem(hdl, TVGN_CHILD);
if (child != NULL) {
HTREEITEM r = __GetNthItem(step, child);
if (r != NULL && step <= 0)
return r;
}
HTREEITEM sibling = m_tree.GetNextSiblingItem(hdl);
if (sibling != NULL) {
HTREEITEM r = __GetNthItem(step, sibling);
if (r != NULL && step <= 0)
return r;
}
return NULL;
}