2

Is there any way to detect if a tree view control (and specifically a TVITEM) is double clicked using Common Controls & WINAPI? I mean in my wndproc function of a form.

If so, what are the msg, wParam & lParam in that case?

aviad1
  • 354
  • 1
  • 10

1 Answers1

3

A treeview control sends an NM_DBLCLK notification when you double-click it, with uMsg = WM_NOTIFY and lParam pointing to an NMHDR structure as per the documentation.

You can then send the treeview control a TVM_HITTEST message to determine the item under the cursor, something like:

TVHITTESTINFO tvhti = {};
GetCursorPos (&tvhti.pt);
ScreenToClient (hTreeView, &tvhti.pt);
SendMessage (hTreeView, TVM_HITTEST, 0, (LPARAM) &tvhti);

See the documentation for the values returned by TVM_HITTEST.

Paul Sanders
  • 24,133
  • 4
  • 26
  • 48