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


C++ TreeView_GetParent函数代码示例

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


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

示例1: treeview_get_path

/*
 * TreeView_GetPath - ツリービューアイテムのパスを取得する
 */
static void treeview_get_path(const HWND hTreeView, const HTREEITEM root, const HTREEITEM hItem, TCHAR *ret)
{
	HTREEITEM pItem;
	TCHAR buf[BUF_SIZE];
	TCHAR name[BUF_SIZE];
	TCHAR work[BUF_SIZE];

	// ルートアイテムの場合はそのままパスを返す
	if (hItem == root) {
		lstrcpy(ret, TEXT("\\"));
		return;
	}

	if (treeview_get_text(hTreeView, hItem, buf) == -1) {
		*ret = TEXT('\0');
		return;
	}
	pItem = TreeView_GetParent(hTreeView, hItem);
	while (pItem != root) {
		treeview_get_text(hTreeView, pItem, name);
		wsprintf(work, TEXT("%s\\%s"), name, buf);
		lstrcpy(buf, work);

		pItem = TreeView_GetParent(hTreeView, pItem);
	}
	// 指定の文字列と結合
	wsprintf(ret, TEXT("\\%s"), buf);
}
开发者ID:tobynet,项目名称:clcl,代码行数:31,代码来源:SelectPath.c

示例2: saveCollapseState

static void saveCollapseState( HWND hwndTree )
{
	HTREEITEM hti;
	TVITEM tvi;
	hti = TreeView_GetRoot( hwndTree );
	while( hti != NULL ) {
		HTREEITEM ht;
		tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
		tvi.hItem = hti;
		tvi.stateMask = (DWORD)-1;
		TreeView_GetItem( hwndTree, &tvi );
		if( tvi.cChildren > 0 ) {
			TreeItem *treeItem = (TreeItem *)tvi.lParam;
			if ( tvi.state & TVIS_EXPANDED )
				DBWriteContactSettingByte(NULL, "KeyBindingsUI", treeItem->paramName, TVIS_EXPANDED );
			else
				DBWriteContactSettingByte(NULL, "KeyBindingsUI", treeItem->paramName, 0 );
		}
		ht = TreeView_GetChild( hwndTree, hti );
		if( ht == NULL ) {
			ht = TreeView_GetNextSibling( hwndTree, hti );
			while( ht == NULL ) {
				hti = TreeView_GetParent( hwndTree, hti );
				if( hti == NULL ) break;
				ht = TreeView_GetNextSibling( hwndTree, hti );
		}	}
		hti = ht;
}	}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:28,代码来源:keybindings.cpp

示例3: parent

TreeView::Item TreeView::parent ( const Item& item ) const
{
    const ::HTREEITEM parent(
        TreeView_GetParent(handle(),item.handle())
    );
    return (Item(parent));
}
开发者ID:AndreLouisCaron,项目名称:w32,代码行数:7,代码来源:TreeView.cpp

示例4: switch

int ShellBrowserChild::Command(int id, int code)
{
	switch(id) {
	  case ID_BROWSE_BACK:
		break;//@todo

	  case ID_BROWSE_FORWARD:
		break;//@todo

	  case ID_BROWSE_UP:
		if (_left_hwnd) {
			//@@ not necessary in this simply case: jump_to(_cur_dir->_up);

			 //@@ -> move into jump_to()
			HTREEITEM hitem = TreeView_GetParent(_left_hwnd, _last_sel);

			if (hitem)
				TreeView_SelectItem(_left_hwnd, hitem);	// sends TVN_SELCHANGED notification
		} else {
			if (_cur_dir->_up)
				jump_to(_cur_dir->_up);
		}
		break;

	  default:
		return 1;
	}

	return 0;
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:30,代码来源:shellbrowser.cpp

示例5: FilterOnInfoTip

LRESULT
FilterOnInfoTip(
	IN HWND hWnd,
	IN HWND hWndTree,
	IN LPNMTVGETINFOTIP lp
	)
{
	HTREEITEM Parent;
	PBTR_FILTER Filter;
	PFILTER_NODE Node;
	RPC_WSTR Uuid = NULL;

	Parent = TreeView_GetParent(hWndTree, lp->hItem);

	if (!Parent) {

		Node = (PFILTER_NODE)lp->lParam;
		Filter = Node->Filter;

		UuidToString(&Filter->FilterGuid, &Uuid);
		StringCchPrintf(lp->pszText, lp->cchTextMax, FILTER_INFOTIP_FORMAT, 
						Filter->FilterName, Filter->Description, Uuid,
						Filter->MajorVersion, Filter->MinorVersion,
						Filter->Author );

		RpcStringFree(&Uuid);
	}

	return 0;	
}
开发者ID:John-Chan,项目名称:dprobe,代码行数:30,代码来源:filterdlg.c

示例6: TreeView_GetSelection

void Explorerplusplus::OnTreeViewFileDelete(BOOL bPermanent)
{
	HTREEITEM		hItem, hParentItem;
	LPITEMIDLIST	pidl = NULL;
	DWORD			fMask = 0;
	HRESULT			hr;

	hItem		= TreeView_GetSelection(m_hTreeView);
	hParentItem = TreeView_GetParent(m_hTreeView,hItem); 

	// Select the parent item to release the lock and allow deletion
	TreeView_Select(m_hTreeView,hParentItem,TVGN_CARET);

	if(hItem != NULL)
	{
		pidl = m_pMyTreeView->BuildPath(hItem);

		if(bPermanent)
		{
			fMask = CMIC_MASK_SHIFT_DOWN;
		}

		hr = ExecuteActionFromContextMenu(pidl,NULL,0,_T("delete"),fMask);

		CoTaskMemFree(pidl);
	}
}
开发者ID:hollylee,项目名称:explorerplusplus,代码行数:27,代码来源:TreeViewHandler.cpp

示例7: wbAddTreeViewItemSibling

HTREEITEM wbAddTreeViewItemSibling(PWBOBJ pwbo, HTREEITEM hItem, LPTSTR lpszItem, int lParam, BOOL bSetlParam, int nImageIndex, int nSelectedImageIndex)
{
	TV_ITEM tvi;
	TV_INSERTSTRUCT tvins;
	PTREEDATA ptrdt	= (PTREEDATA)pwbo->lparam;

	if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd))
		return FALSE;

	if((!lpszItem || !*lpszItem))
		return NULL;

	// Add the item

	tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | (bSetlParam ? TVIF_PARAM : 0);
	tvi.pszText = lpszItem;
	tvi.cchTextMax = wcslen(lpszItem);
	tvi.lParam = lParam;
	tvi.iImage = (nImageIndex >= 0 ? nImageIndex : 4);	// Default image indices: 4, 5
	tvi.iSelectedImage = (nSelectedImageIndex >= 0 ? nSelectedImageIndex : 5);

	if(!hItem)
		tvins.hParent = TVI_ROOT;
	else
		tvins.hParent = TreeView_GetParent(pwbo->hwnd, hItem);

	tvins.hInsertAfter = hItem;
	tvins.item = tvi;

	// Insert the item

	ptrdt->hLast = TreeView_InsertItem(pwbo->hwnd, &tvins);
	return ptrdt->hLast;
}
开发者ID:Darksynx,项目名称:WinBinder,代码行数:34,代码来源:wb_control_treeview.c

示例8: OptTree_Translate

void OptTree_Translate(HWND hwndTree)
{
    HTREEITEM hItem = TreeView_GetRoot(hwndTree);
    while (hItem)
    {
        HTREEITEM hItemTmp = 0;

        OptTree_TranslateItem(hwndTree, hItem);
        if (hItemTmp = TreeView_GetChild(hwndTree, hItem))
        {
            hItem = hItemTmp;
        } else if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
        {
            hItem = hItemTmp;
        } else
        {
            while (1)
            {
                if (!(hItem = TreeView_GetParent(hwndTree, hItem))) break;
                if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
                {
                    hItem = hItemTmp;
                    break;
                }
            }
        }
    }
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:28,代码来源:opttree.cpp

示例9: GetDlgItem

void CWindowTreeDlg::SelectTreeItem(HWND windowHwnd)
{
    HWND _windowTreeHwnd = GetDlgItem(*this, IDC_WINDOWTREE);
    HTREEITEM actualItem = TreeView_GetFirstVisible(_windowTreeHwnd);

    // Search by the item into the list
    while (actualItem != NULL)
    {
        TVITEM tvi = {0};
        tvi.hItem = actualItem;
        tvi.mask = TVIF_PARAM;
        TreeView_GetItem(_windowTreeHwnd, &tvi);

        // If it is the item, select it and break the search
        if ((HWND)tvi.lParam == windowHwnd)
        {
            TreeView_SelectItem(_windowTreeHwnd, actualItem);
            break;
        }

        // Find the next item in the TreeView
        HTREEITEM nextItem = TreeView_GetChild(_windowTreeHwnd, actualItem);
        if (nextItem == NULL)
            nextItem = TreeView_GetNextSibling(_windowTreeHwnd, actualItem);

        HTREEITEM parentItem = actualItem;
        while ((nextItem == NULL) && (parentItem != NULL))
        {
            parentItem = TreeView_GetParent(_windowTreeHwnd, parentItem);
            nextItem = TreeView_GetNextSibling(_windowTreeHwnd, parentItem);
        }
        actualItem = nextItem;
    }
}
开发者ID:dbremner,项目名称:sendmessage,代码行数:34,代码来源:WindowTreeDlg.cpp

示例10: RebuildPath

static BOOL CALLCONV RebuildPath(HWND hTreeCtrl, HTREEITEM hItem, LPWSTR szPath)
{
	WCHAR name[MAX_PATH];
	TVITEMW item;
	HTREEITEM hParent;
	name[0]=0;
	item.hItem = hItem;
	item.cchTextMax = MAX_PATH-1;
	item.pszText = name;
	item.mask = TVIF_TEXT|TVIF_PARAM;
	TreeView_GetItem(hTreeCtrl,&item);
	hParent = TreeView_GetParent(hTreeCtrl,hItem);
	if(hParent)
	{
		RebuildPath(hTreeCtrl, hParent, szPath);
		lstrcatW(szPath,L"\\");
	}
	if(item.lParam == TVNT_DIR)
	{
		lstrcatW(szPath,item.pszText+1);
		szPath[lstrlenW(szPath)-1]=0;
		return TRUE;
	}
	else if(item.lParam == TVNT_EMPTY)
	{
		szPath[0] = 0;
		return TRUE;
	}
	else
	{
		lstrcatW(szPath,item.pszText);
		return TRUE;
	}
}
开发者ID:embassy,项目名称:AkelPad,代码行数:34,代码来源:Templates.c

示例11: 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

示例12: IGetNextTreeItem

HTREEITEM   IGetNextTreeItem( HWND tree, HTREEITEM item )
{
    // First try child items of this one
    HTREEITEM next = TreeView_GetChild( tree, item );
    if( next == nil )
        // If no child items, try next sibling
        next = TreeView_GetNextSibling( tree, item );
    if( next == nil )
    {
        // If no siblings, go up to the parent and keep searching until we find a parent with a sibling
        next = item;
        while( true )
        {
            next = TreeView_GetParent( tree, next );
            if( next == nil )
            {
                // No parent; not found, so stop
                break;
            }
            else if( TreeView_GetNextSibling( tree, next ) != nil )
            {
                next = TreeView_GetNextSibling( tree, next );
                break;
            }
        }
    }

    return next;
}
开发者ID:RPLawrence,项目名称:Plasma,代码行数:29,代码来源:plResTreeView.cpp

示例13: 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

示例14: wbGetTreeViewItemParent

HTREEITEM wbGetTreeViewItemParent(PWBOBJ pwbo, HTREEITEM hItem)
{
	if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd))
		return FALSE;

	if(!hItem)
		return FALSE;

	return TreeView_GetParent(pwbo->hwnd, hItem);
}
开发者ID:Darksynx,项目名称:WinBinder,代码行数:10,代码来源:wb_control_treeview.c

示例15: FilterOnWmUncheckItem

LRESULT
FilterOnWmUncheckItem(
	IN HWND hWnd, 
	IN UINT uMsg, 
	IN WPARAM wp, 
	IN LPARAM lp
	)
{
	HWND hWndTree;
	TVITEMEX Item = {0};
	HTREEITEM hItem;
	ULONG NewState;
	ULONG OldState;

	hWndTree = GetDlgItem(hWnd, IDC_TREE_FILTER);

	//
	// Get the current state of treeview item
	//

	hItem = (HTREEITEM)wp;

	Item.mask = TVIF_STATE;
	Item.stateMask = TVIS_STATEIMAGEMASK ;
	Item.hItem = hItem;
	TreeView_GetItem(hWndTree, &Item);

	OldState = Item.state;

	//
	// Clear check state and get new state
	//

	TreeView_SetCheckState(hWndTree, hItem, FALSE);

	Item.mask = TVIF_STATE;
	Item.stateMask = TVIS_STATEIMAGEMASK ;
	Item.hItem = hItem;
	TreeView_GetItem(hWndTree, &Item);

	NewState = Item.state;

	//
	// N.B. This message can only be triggered to child item, NULL lParam
	//

	FilterOnItemChanged(hWnd, hWndTree, hItem, NewState, OldState, 0);
	
	//
	// Always clear check state of its parent
	//

	TreeView_SetCheckState(hWndTree, TreeView_GetParent(hWndTree, hItem), FALSE);
	return 0L;
}
开发者ID:John-Chan,项目名称:dprobe,代码行数:55,代码来源:filterdlg.c


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