Quest
Quest

Reputation: 2843

Handling TreeView mouse double click

How to handle TreeView double or right mouse click in WinProc? i have tried this:

if(LOWORD(wParam) == GetWindowID(g_hWndTV &&
    HIWORD(wParam) == WM_RBUTTONUP)
......

but this does not work. Thanks for answers

Upvotes: 0

Views: 1420

Answers (1)

Jonathan Potter
Jonathan Potter

Reputation: 37132

Both these events will come via a WM_NOTIFY message sent to the tree control's parent window. You'll get NM_RCLICK for a right-click, and NM_DBLCLK for a double-click.

case WM_NOTIFY:
    if (reinterpret_cast<LPNMHDR>(lParam)->hwndFrom == g_hWndTV)
    {
         if (reinterpret_cast<LPNMHDR>(lParam)->code == NM_RCLICK)
         {
              // right-click
         }
         else
         if (reinterpret_cast<LPNMHDR>(lParam)->code == NM_DBLCLK)
         {
              // double-click
         }
    }
    break;

Upvotes: 1

Related Questions