分类: C/C++
2008-08-05 13:52:17
class CTreeCtrlDlg : public CDialog { ………… public: HTREEITEM m_hTreeItem; CImageList m_ImgLst; // Dialog Data //{{AFX_DATA(CTreeCtrlDlg) enum { IDD = IDD_TREECTRL_DIALOG }; CTreeCtrl m_wndTree;//与对话框中树控件相关联 //}}AFX_DATA // Implementation protected: afx_msg void OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult); ………… };
void CTreeCtrlDlg::OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult) { m_hTreeItem = m_wndTree.GetSelectedItem(); //以GetItemText()函数为例: CString S1 = m_wndTree.GetItemText(m_hTreeItem); AfxMessageBox("You have selected " S1); *pResult = 0; }(全文完) 下载本文示例代码