本文将给出一个源程序
在一个对话框中的TreeCtrl中用树的形式枚举窗口
这是头文件
// WinList.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CWinList dialog
class CWinList : public CDialog
{
// Construction
public:
HWND m_hSelected;
CWinList(CWnd* pParent = NULL); // standard constructor
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
static BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam);
void BuiltTree(HWND hWnd);
// Dialog Data
//{{AFX_DATA(CWinList)
enum { IDD = ID_WINLIST };
CTreeCtrl m_Tree;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWinList)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void DrawFlash(HWND hWnd);
void Refresh();
// Generated message map functions
//{{AFX_MSG(CWinList)
virtual BOOL OnInitDialog();
afx_msg void OnRefresh();
afx_msg void OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CFont TreeFont;
TV_INSERTSTRUCT TreeItem;
int RootPt;
HTREEITEM RootArray[10];
};
--
┌————┐
│ 贝 贝 │
└————┘
本文地址:http://com.8s8s.com/it/it24981.htm