当前位置: 首页>>代码示例>>C++>>正文


C++ TreeView_GetChild函数代码示例

本文整理汇总了C++中TreeView_GetChild函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_GetChild函数的具体用法?C++ TreeView_GetChild怎么用?C++ TreeView_GetChild使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TreeView_GetChild函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetTVPath

void 
FileTransfer::ShowTreeViewItems(HWND hwnd, LPNMTREEVIEW m_lParam)
{
    HANDLE m_handle;
    WIN32_FIND_DATA m_FindFileData;
    TVITEM tvi;
    TVINSERTSTRUCT tvins;
    char path[rfbMAX_PATH];
    GetTVPath(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem, path);
    strcat(path, "\\*");
    while (TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem) != NULL) {
        TreeView_DeleteItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem));
    }
    SetErrorMode(SEM_FAILCRITICALERRORS);
    m_handle = FindFirstFile(path, &m_FindFileData);
    SetErrorMode(0);
    if (m_handle == INVALID_HANDLE_VALUE) return;
    while(1) {
        if ((strcmp(m_FindFileData.cFileName, ".") != 0) && 
            (strcmp(m_FindFileData.cFileName, "..") != 0)) {
            if (m_FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {	
                tvi.mask = TVIF_TEXT;
                tvi.pszText = m_FindFileData.cFileName;
                tvins.hParent = m_lParam->itemNew.hItem;
                tvins.item = tvi;
                tvins.hParent = TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
                TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
            }
        }
        if (!FindNextFile(m_handle, &m_FindFileData)) break;
    }
    FindClose(m_handle);
}
开发者ID:bk138,项目名称:CollabTool,代码行数:33,代码来源:FileTransfer.cpp

示例2: ExtractAll

void ExtractAll()
{
    TVITEM t; int i, nl; char *s; HTREEITEM hn, hm; FILE *log;
    //log = fopen("exalltest.txt", "w");
    if(!file) return;
    nl = TreeView_GetCount(htree);
    t.mask = TVIF_PARAM;
    t.hItem = TreeView_GetChild(htree, TVI_ROOT); // First item
    for(i = 0; i < nl; i++)
    {
        TreeView_GetItem(htree, &t);
        s = GetItemPath(t.hItem);
        if(!s) {MessageBox(hwnd, "GetItemPath pathbuf overflow!", title, 16); break;}
        if(t.lParam != -1)
        {
            EnsureDirectoriesArePresent(s);
            ExtractFile(t.lParam, s);
            //fprintf(log, "FILE ");
        }//else	fprintf(log, " DIR ");
        //fprintf(log, "%i: %s\n", i, s);
        hn = TreeView_GetChild(htree, t.hItem);
        if(!hn) hn = TreeView_GetNextSibling(htree, t.hItem);
        if(!hn)
        {
            hn = t.hItem;
gns:			hn = TreeView_GetParent(htree, hn);
            if(!hn) break;
            hm = TreeView_GetNextSibling(htree, hn);
            if(!hm) goto gns;
            hn = hm;
        }
        t.hItem = hn;
    }
    //fclose(log);
}
开发者ID:AdrienTD,项目名称:wktools,代码行数:35,代码来源:bcpview.c

示例3: ExcludePathsDlg_SetCheckState_r

//-----------------------------------------------------------------------------
//	ExcludePathsDlg_SetCheckState_r
//
//	Propogate the check state to all children
//-----------------------------------------------------------------------------
void ExcludePathsDlg_SetCheckState_r( HWND hWndTree, HTREEITEM hTree, int depth, int checkState )
{
    if ( !hTree )
    {
        return;
    }

    TreeView_SetCheckState( hWndTree, hTree, ( checkState == 1 ) );

    TVITEM tvi = { 0 };
    tvi.mask = TVIF_HANDLE | TVIF_CHILDREN;
    tvi.hItem = hTree;
    if ( TreeView_GetItem( hWndTree, &tvi ) )
    {
        if ( tvi.cChildren )
        {
            HTREEITEM hChild = TreeView_GetChild( hWndTree, hTree );
            if ( hChild )
            {
                ExcludePathsDlg_SetCheckState_r( hWndTree, hChild, depth+1, checkState );
            }
        }
    }
    else
    {
        return;
    }

    if ( !depth )
    {
        // only iterate siblings of the parent's child
        return;
    }

    HTREEITEM hSibling = hTree;
    while ( 1 )
    {
        hSibling = TreeView_GetNextSibling( hWndTree, hSibling );
        if ( !hSibling )
        {
            return;
        }

        TreeView_SetCheckState( hWndTree, hSibling, ( checkState == 1 ) );

        tvi.hItem = hSibling;
        if ( TreeView_GetItem( hWndTree, &tvi ) )
        {
            if ( tvi.cChildren )
            {
                HTREEITEM hChild = TreeView_GetChild( hWndTree, hSibling );
                if ( hChild )
                {
                    ExcludePathsDlg_SetCheckState_r( hWndTree, hChild, depth+1, checkState );
                }
            }
        }
    }
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:64,代码来源:exclude_paths.cpp

示例4: doItems

void doItems(HWND hwnd2Tree, ModuleSettingLL *modlist, int count)
{
    HWND hwnd = GetParent(hwnd2Tree);

    char percent[96], title[64];
    mir_snprintf(title, SIZEOF(title), Translate("Loading modules..."));

    TVITEM item = {0};
    item.mask = TVIF_STATE | TVIF_PARAM;

    HTREEITEM contact = TreeView_GetChild(hwnd2Tree, TVI_ROOT);
    contact = TreeView_GetNextSibling(hwnd2Tree, contact);
    contact = TreeView_GetChild(hwnd2Tree, contact);

    MCONTACT hContact = 0;
    for (int i = 1; contact && hwnd2mainWindow; i++) {
        item.hItem = contact;
        contact = TreeView_GetNextSibling(hwnd2Tree, contact);

        if (TreeView_GetItem(hwnd2Tree, &item) && item.lParam) {
            ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;
            hContact = mtis->hContact;
            if (hContact == NULL || mtis->type != (CONTACT | EMPTY))
                continue;
            mtis->type = CONTACT;
        }
        else
            continue;

        // Caption
        mir_snprintf(percent, SIZEOF(percent), "%s %d%%", title, (int)(100 * i / count));
        SetWindowText(hwnd, percent);

        for (ModSetLinkLinkItem *module = modlist->first; module && hwnd2mainWindow; module = module->next) {
            if (!module->name[0] || IsModuleEmpty(hContact, module->name))
                continue;

            TVINSERTSTRUCT tvi;
            tvi.hParent = item.hItem;
            tvi.hInsertAfter = TVI_SORT;
            tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
            tvi.item.pszText = module->name;

            ModuleTreeInfoStruct *lParam = (ModuleTreeInfoStruct *)mir_calloc(sizeof(ModuleTreeInfoStruct));
            lParam->hContact = hContact;

            tvi.item.iImage = 1;
            tvi.item.iSelectedImage = 2;
            lParam->type = KNOWN_MODULE;

            tvi.item.lParam = (LPARAM)lParam;
            TreeView_InsertItem(hwnd2Tree, &tvi);
        }
    }

    SetWindowText(hwnd, TranslateT("Database Editor++"));
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:57,代码来源:moduletree.cpp

示例5: FreeDeviceStrings

VOID
FreeDeviceStrings(HWND hTreeView)
{
    HTREEITEM hItem;

    hItem = TreeView_GetRoot(hTreeView);

    if (hItem)
    {
        hItem = TreeView_GetChild(hTreeView,
                                  hItem);
        /* loop the parent items */
        while (hItem)
        {
            hItem = TreeView_GetChild(hTreeView,
                                      hItem);
            if (hItem == NULL)
                break;

            /* loop the child items and free the DeviceID */
            while (TRUE)
            {
                HTREEITEM hOldItem;
                TV_ITEM tvItem;
                //TCHAR Buf[100];

                tvItem.hItem = hItem;
                tvItem.mask = TVIF_PARAM;// | TVIF_TEXT;
                //tvItem.pszText = Buf;
                //tvItem.cchTextMax = 99;

                (void)TreeView_GetItem(hTreeView, &tvItem);

                //MessageBox(NULL, Buf, NULL, 0);

                HeapFree(GetProcessHeap(),
                         0,
                         (LPTSTR)tvItem.lParam);

                hOldItem = hItem;

                hItem = TreeView_GetNextSibling(hTreeView,
                                                hItem);
                if (hItem == NULL)
                {
                    hItem = hOldItem;
                    break;
                }
            }

            hItem = TreeView_GetParent(hTreeView,
                                       hItem);
            hItem = TreeView_GetNextSibling(hTreeView,
                                            hItem);
        }
    }
}
开发者ID:RPG-7,项目名称:reactos,代码行数:57,代码来源:enumdevices.c

示例6: TreeViewFindCheck

void TreeViewFindCheck(HTREEITEM parent,bool force)
{
    TVITEM tvItem;
    bool lforce;
    ZeroMemory(&tvItem,sizeof(TVITEM));
    HTREEITEM locHti,tmpHti;
    wchar_t buff[2048]; wmemset(buff,'\0',2048);
    if (parent==NULL)
    {
        locHti=TreeView_GetRoot(App.hTreeView);
    }
    else
    {
        locHti=TreeView_GetChild(App.hTreeView,parent);
    }
    do
    {
        lforce=false;
        tvItem.mask = TVIF_HANDLE | TVIF_TEXT;
        tvItem.hItem = locHti;
        tvItem.pszText = buff;
        tvItem.cchTextMax = 2048;
        TreeView_GetItem(App.hTreeView,&tvItem);
        if (TreeView_GetCheckState(App.hTreeView,locHti)==1 || force)
        {
            switch (tvItem.lParam)
            {
                case 10:
                    semafor=1;
                    //TreeView_Select(App.hTreeView,locHti,TVGN_CARET);
                    //TreeView_Expand(App.hTreeView,locHti,TVE_EXPAND);
                    _beginthreadex(NULL,0,ThreadScanFolder,(void *)locHti,0,NULL);
                    lforce=TRUE;
                    while (semafor==1)
                    {Sleep(100);}
                break;
                case 20:
                    semafor=1;
                    //TreeView_Select(App.hTreeView,locHti,TVGN_CARET);
                    //TreeView_Expand(App.hTreeView,locHti,TVE_EXPAND);
                    _beginthreadex(NULL,0,ThreadScanFile,(void *)locHti,0,NULL);
                    lforce=TRUE;
                    while (semafor==1)
                    {Sleep(100);}
                break;
            }
        }
        if (tmpHti=TreeView_GetChild(App.hTreeView,locHti))
        {
            TreeViewFindCheck(locHti,lforce);
        }
    }
    while(locHti=TreeView_GetNextSibling(App.hTreeView,locHti));
}
开发者ID:Joelone,项目名称:MLEA,代码行数:54,代码来源:_main.cpp

示例7: freeTree

void freeTree(HWND hwnd2Tree, MCONTACT hContact)
{
    TVITEM item;
    HTREEITEM lastItem;
    if (!TreeView_GetCount(hwnd2Tree))
        return;

    item.mask = TVIF_STATE | TVIF_PARAM;
    item.hItem = TVI_ROOT;
    do {
        do {
            lastItem = item.hItem;
            if (lastItem != TVI_ROOT) {
                TreeView_GetItem(hwnd2Tree, &item);
                /* these next 2 lines are not from code guru..... */
                if (item.lParam) {
                    ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;

                    if (!hContact || (hContact == mtis->hContact)) {
                        if (hContact != NULL) {
                            TreeView_DeleteItem(hwnd2Tree, item.hItem);
                            mir_free(mtis);
                        }
                        else
                            mtis->type = STUB;
                    }
                }
                /* back to coduguru's code*/
            }
        } while (item.hItem = TreeView_GetChild(hwnd2Tree, lastItem));

        while (!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem)) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem))) {}

    } while (item.hItem);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:35,代码来源:moduletree.cpp

示例8: _treeview_getitemfrompath

static HTREEITEM _treeview_getitemfrompath(HWND treeview, HTREEITEM parent,
                       char *path)
{
    char *fname, name[BUFSIZE], iname[BUFSIZE];
    HTREEITEM child;

    if (!path || path[0] == '\0')
    return parent;

    memset(name, 0, BUFSIZE);
    fname = firstname(path);
    memmove(name, path, fname - path);
    child = TreeView_GetChild(treeview, parent);

    if (!child)
    return parent;

    do {
    treeview_getitemname(treeview, child, iname, BUFSIZE);
    if (!strcmp(name, iname)) {
        if (!fname[0])
        return child;
        else
        return _treeview_getitemfrompath(treeview, child,
                         fname + 1);
    };
    } while (child = TreeView_GetNextSibling(treeview, child));

    return NULL;
};
开发者ID:nohuhu,项目名称:TuTTY,代码行数:30,代码来源:misc.c

示例9: findItemInTree

int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char *module)
{
    TVITEM item;
    char text[265];
    HTREEITEM lastItem;
    if (!TreeView_GetCount(hwnd2Tree))
        return 0;

    item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
    item.hItem = TVI_ROOT;
    item.pszText = text;
    item.cchTextMax = 264;
    do {
        do {
            lastItem = item.hItem;
            if (lastItem != TVI_ROOT) {
                /* these next 2 lines are not from code guru..... */
                if (TreeView_GetItem(hwnd2Tree, &item) && item.lParam) {
                    if ((hContact == ((ModuleTreeInfoStruct *)item.lParam)->hContact) && (!module[0] || !mir_strcmp(module, text))) {
                        //TreeView_SelectItem(hwnd2Tree,item.hItem);
                        return (int)item.hItem;
                    }
                }
                /* back to coduguru's code*/
            }
        } while ((item.hItem = TreeView_GetChild(hwnd2Tree, lastItem)));

        while ((!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem))) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem)));

    } while (item.hItem);
    return -1;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:32,代码来源:moduletree.cpp

示例10: TreeView_GetItem1

void tvisual::on_rclick(LPNMHDR lpNMHdr, HTREEITEM htvi)
{
    TVITEMEX tvi;

    if (type_ == BIN_WML) {
        TreeView_GetItem1(lpNMHdr->hwndFrom, htvi, &tvi, TVIF_CHILDREN, NULL);
        if (tvi.cChildren && !TreeView_GetChild(lpNMHdr->hwndFrom, htvi)) {
            std::vector<std::pair<LPARAM, std::string> > vec;
            LPARAM cfg_index;
            const config* cfg = &game_config_;

            TreeView_FormVector(lpNMHdr->hwndFrom, htvi, vec);
            for (std::vector<std::pair<LPARAM, std::string> >::reverse_iterator ritor = vec.rbegin(); ritor != vec.rend(); ++ ritor) {
                if (ritor == vec.rbegin()) {
                    continue;
                }
                cfg_index = 0;
                foreach (const config::any_child& value, cfg->all_children_range()) {
                    if (cfg_index ++ == ritor->first) {
                        cfg = &value.cfg;
                        break;
                    }
                }
            }
            wml_2_tv(lpNMHdr->hwndFrom, htvi, *cfg, 0);
        }
开发者ID:SkyPrayerStudio,项目名称:War-Of-Kingdom,代码行数:26,代码来源:DlgVisualProc.cpp

示例11: TreeItemForPageNoRec

static void TreeItemForPageNoRec(WindowInfo *win, HTREEITEM hItem, int pageNo, HTREEITEM& bestMatchItem, int& bestMatchPageNo)
{
    while (hItem && bestMatchPageNo < pageNo) {
        TVITEM item;
        item.hItem = hItem;
        item.mask = TVIF_PARAM | TVIF_STATE;
        item.stateMask = TVIS_EXPANDED;
        TreeView_GetItem(win->hwndTocTree, &item);

        // remember this item if it is on the specified page (or on a previous page and closer than all other items)
        if (item.lParam) {
            int page = ((DocTocItem *)item.lParam)->pageNo;
            if (page <= pageNo && page >= bestMatchPageNo && page >= 1) {
                bestMatchItem = hItem;
                bestMatchPageNo = page;
            }
        }

        // find any child item closer to the specified page
        HTREEITEM hSubItem = nullptr;
        if ((item.state & TVIS_EXPANDED))
            TreeItemForPageNoRec(win, TreeView_GetChild(win->hwndTocTree, hItem), pageNo, bestMatchItem, bestMatchPageNo);

        hItem = TreeView_GetNextSibling(win->hwndTocTree, hItem);
    }
}
开发者ID:victorbriz,项目名称:sumatrapdf,代码行数:26,代码来源:TableOfContents.cpp

示例12: TreeView_GetChild

LRESULT CBrowseDocker::OnRefresh(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
    if (m_rightClickNode != NULL)
    {
        HTREEITEM hChild = TreeView_GetChild(m_view->m_hWnd, m_rightClickNode);
        if (hChild)
        {
            bool expanded = (TreeView_GetItemState(m_view->m_hWnd, m_rightClickNode, TVIS_EXPANDED) & TVIS_EXPANDED) == TVIS_EXPANDED;
            TreeView_Expand(m_view->m_hWnd, m_rightClickNode, TVE_COLLAPSERESET | TVE_COLLAPSE);

            /*while(hChild)
            {
                TreeView_DeleteItem(m_view->m_hWnd, hChild);
                hChild = TreeView_GetChild(m_view->m_hWnd, m_rightClickNode);
            }*/

            if (expanded)
            {
                TreeView_Expand(m_view->m_hWnd, m_rightClickNode, TVE_EXPAND);
            }
        }
    }

    return 0;
}
开发者ID:ALPHAMARIOX,项目名称:pn,代码行数:25,代码来源:browseview.cpp

示例13: _ASSERTE

bool CFileGroups::AddFile(HWND hwndTVCtrl, HTREEITEM hGroup, const char *filepath) {
    _ASSERTE(hGroup != NULL);
    _ASSERTE(filepath != 0);
    _ASSERTE(qfileexist(filepath));
    if (hGroup == NULL || filepath == 0 || !qfileexist(filepath)) return false;
    for (HTREEITEM hChild = TreeView_GetChild(hwndTVCtrl, hGroup);
        hChild != NULL; hChild = TreeView_GetNextSibling(hwndTVCtrl, hChild)) {
        char text[MAX_PATH];
        TVITEMEX tvi;
        tvi.mask = TVIF_HANDLE | TVIF_TEXT;
        tvi.hItem = hGroup;
        tvi.pszText = text;
        tvi.cchTextMax = sizeof text;
        if (TreeView_GetItem(hwndTVCtrl, &tvi)) {
            if (_stricmp(filepath, text) == 0) return false; // no dupes!
        }
#ifdef _DEBUG
        else
            _RPTF4(_CRT_ERROR, "%s(%08X, ..., \"%s\"): TreeView_GetItem(%08X, ...) returned NULL",
                __FUNCTION__, hwndTVCtrl, filepath, hwndTVCtrl);
#endif // _DEBUG
    }
    TVINSERTSTRUCT tvis;
    tvis.hParent = hGroup;
    tvis.hInsertAfter = TVI_SORT;
    tvis.itemex.mask = TVIF_TEXT;
    tvis.itemex.pszText = const_cast<LPTSTR>(filepath);
    const HTREEITEM hti(TreeView_InsertItem(hwndTVCtrl, &tvis));
    _ASSERTE(hti != NULL);
    return hti != NULL;
}
开发者ID:IDA-RE-things,项目名称:idaplugs,代码行数:31,代码来源:plugfgrp.cpp

示例14: TreeItemForPageNo

static HTREEITEM TreeItemForPageNo(WindowInfo *win, HTREEITEM hItem, int pageNo)
{
    HTREEITEM hCurrItem = nullptr;

    while (hItem) {
        TVITEM item;
        item.hItem = hItem;
        item.mask = TVIF_PARAM | TVIF_STATE;
        item.stateMask = TVIS_EXPANDED;
        TreeView_GetItem(win->hwndTocTree, &item);

        // return if this item is on the specified page (or on a latter page)
        if (item.lParam) {
            int page = ((DocTocItem *)item.lParam)->pageNo;
            if (1 <= page && page <= pageNo)
                hCurrItem = hItem;
            if (page >= pageNo)
                break;
        }

        // find any child item closer to the specified page
        HTREEITEM hSubItem = nullptr;
        if ((item.state & TVIS_EXPANDED))
            hSubItem = TreeItemForPageNo(win, TreeView_GetChild(win->hwndTocTree, hItem), pageNo);
        if (hSubItem)
            hCurrItem = hSubItem;

        hItem = TreeView_GetNextSibling(win->hwndTocTree, hItem);
    }

    return hCurrItem;
}
开发者ID:AnthonyLu-Ista,项目名称:sumatrapdf,代码行数:32,代码来源:TableOfContents.cpp

示例15: if

BBTreeViewNode *Win32TreeViewNode::insert( int index,BBString *str,int icon ){

    HTREEITEM p;

    if( index<=0 ){
        p=TVI_FIRST;
    }else if( index>=countKids() ){
        p=TVI_LAST;
    }else{
        p=TreeView_GetChild( _tree,_item );
        while( --index ){
            p=TreeView_GetNextSibling( _tree,p ); 
        }
    }

    TVINSERTSTRUCT it;
    it.hParent=_item;
    it.hInsertAfter=p;
    it.item.mask=TVIF_TEXT;
    it.item.pszText=(char*)str->c_str();

    HTREEITEM item=TreeView_InsertItem( _tree,&it );
    if( !item ) return 0;

    Win32TreeViewNode *node=new Win32TreeViewNode( _tree,item,this );

    TVITEM tv={TVIF_PARAM};
    tv.hItem=item;
    tv.lParam=(LPARAM)node;
    if (icon>-1) {tv.mask|=TVIF_IMAGE|TVIF_SELECTEDIMAGE;tv.iImage=icon;tv.iSelectedImage=icon+0;}
    TreeView_SetItem( _tree,&tv );

    return node;
}
开发者ID:JamesLinus,项目名称:blitzplus,代码行数:34,代码来源:win32treeview.cpp


注:本文中的TreeView_GetChild函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。