在 CTreeCtrl 中枚举系统中的所有窗口!(I)
生活随笔
收集整理的這篇文章主要介紹了
在 CTreeCtrl 中枚举系统中的所有窗口!(I)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
本文將給出一個源程序?
在一個對話框中的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];?
};?
?
?
--?
┌————┐?
│?貝??貝?│??
└————┘??
??????????????
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎
在一個對話框中的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];?
};?
?
?
--?
┌————┐?
│?貝??貝?│??
└————┘??
??????????????
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎
總結
以上是生活随笔為你收集整理的在 CTreeCtrl 中枚举系统中的所有窗口!(I)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 重磅!吴恩达、林轩田公开课交流群正式成立
- 下一篇: 程序员美团面试挂了,7天后去腾讯面试,见