QuakeGod
2023-05-19 418cb35b936f21415807a2bcc21b2d75934bd4d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
#include "pch.h"
#include "framework.h"
#include "ViewTree.h"
#include "MTerm1.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
/////////////////////////////////////////////////////////////////////////////
// CViewTree
 
CViewTree::CViewTree() noexcept
{
}
 
CViewTree::~CViewTree()
{
}
 
BEGIN_MESSAGE_MAP(CViewTree, CTreeCtrl)
//    ON_NOTIFY_REFLECT(NM_DBLCLK, &CViewTree::OnDblClkTree)
//    ON_NOTIFY_REFLECT(NM_CLICK, &CViewTree::OnClkTree)
 
END_MESSAGE_MAP()
 
/////////////////////////////////////////////////////////////////////////////
// CViewTree 消息处理程序
 
BOOL CViewTree::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
    BOOL bRes = CTreeCtrl::OnNotify(wParam, lParam, pResult);
 
    NMHDR* pNMHDR = (NMHDR*)lParam;
    ASSERT(pNMHDR != nullptr);
 
    if (pNMHDR && pNMHDR->code == TTN_SHOW && GetToolTips() != nullptr)
    {
        GetToolTips()->SetWindowPos(&wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSIZE);
    }
 
    return bRes;
}
 
void CViewTree::OnClkTree(NMHDR* pNMHDR, LRESULT* pResult)
{
 
    HTREEITEM hTreeItem = GetSelectedItem();
    //以GetItemText()函数为例: 
    CString S1 = GetItemText(hTreeItem);
//    AfxMessageBox(_T("You have selected ") + S1);
 
    *pResult = 0;
 
}
 
void CViewTree::OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
 
    HTREEITEM hTreeItem = GetSelectedItem();
    //以GetItemText()函数为例: 
    CString s2 = GetItemText(hTreeItem);
        //AfxMessageBox(_T("You have selected ") + s1);
    CString s1;
    DWORD_PTR dw = GetItemData(hTreeItem);
    s1.Format(_T("dbclk action %d, id %d oldid %d data %d x %d y %d  text %s "),
        pNMTreeView->action, hTreeItem, pNMTreeView->itemOld.hItem, dw, pNMTreeView->ptDrag.x, pNMTreeView->ptDrag.y,s2);
    
    SysLog(s1);
 
    *pResult = 0;
}