⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 explorertreeview.h

📁 类似资源管理器的vc源代码,实现起来相当不容易啊,要细心琢磨
💻 H
字号:
#if !defined(AFX_EXPLORERTREEVIEW_H__CEBD0E69_9A5E_4C4D_B5D5_B30D9F1F0DDC__INCLUDED_)
#define AFX_EXPLORERTREEVIEW_H__CEBD0E69_9A5E_4C4D_B5D5_B30D9F1F0DDC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ExplorerTreeView.h : header file
//
#include <afxcview.h>
#include "ShellPidl.h"
#include "ExplorerTreeTarget.h"

/////////////////////////////////////////////////////////////////////////////
// CExplorerTreeView view

class CExplorerTreeView : public CTreeView, public CShellPidl
{
protected:
	CExplorerTreeView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CExplorerTreeView)


// Attributes
public:
	CTreeCtrl    * m_pTreeCtrl;
	IShellFolder * m_psfDesk;
	ITEMIDLIST   * m_pidlDesk, * m_pidlMyComputer;

	HTREEITEM      m_hDesktop;
	HTREEITEM      m_hMyComputer;

	HTREEITEM      m_hMoveSrc;
	HTREEITEM      m_hSelItem;
	LPTREEPARAM    m_pSelLiParam;

	CExplorerTreeTarget m_TreeTarget;

// Operations

public:
	LPTREEPARAM GetSelTreeData();
	void SetTreeContext(IShellFolder *psfParent, LPITEMIDLIST pidlParent);
	void SetSubItemFolder(TV_ITEM tvItemParent);
	static int CALLBACK SortMyComputer(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	void InitExplorerTree();

	void AddChildren(IShellFolder *psfParent, LPITEMIDLIST pidlParent, HTREEITEM hParent, BOOL bExpand);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CExplorerTreeView)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CExplorerTreeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:

	HTREEITEM FindSubItemByPath(HTREEITEM hParent, LPSTR szPathName);

	void InitImageList();
	//{{AFX_MSG(CExplorerTreeView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	afx_msg long OnRefreshTree(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EXPLORERTREEVIEW_H__CEBD0E69_9A5E_4C4D_B5D5_B30D9F1F0DDC__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -