- I was trying to do this via more traditional methods, but it didn't work, in case someone can point out what's going on here. If I could get this to work on an internal control, I would then try and get this working on an external control using remote buffers.
Code: Select all
q:: ;treeview GUI
Gui, New, +HwndhGui, MyWinTitle
Gui, Add, TreeView, gMyTVSub
vTV1 := TV_Add("TV 1", "", "Select")
vTV2 := TV_Add("TV 2", vTV1)
vTV3 := TV_Add("TV 3", vTV2)
vTV4 := TV_Add("TV 4", vTV1)
vTV5 := TV_Add("TV 5")
Gui, Show, w300 h300
return
MyTVSub:
ToolTip, % A_GuiEvent
return
;Tree View Notifications (Windows)
;https://msdn.microsoft.com/en-us/library/windows/desktop/ff486107(v=vs.85).aspx
w:: ;treeview - attempt to double-click focused item
ControlGet, hCtl, Hwnd,, SysTreeView321, A
;TVGN_CARET := 0x9
;hItem := SendMessage(0x110A, 0x9, 0,, "ahk_id " hCtl) ;TVM_GETNEXTITEM := 0x110A
;GWL_ID := -12
vCtlID := DllCall("GetWindowLong" (A_PtrSize=8?"Ptr":""), Ptr,hCtl, Int,-12, Ptr)
VarSetCapacity(NMHDR, A_PtrSize=8?24:12, 0)
NumPut(hCtl, &NMHDR, 0, "Ptr") ;hwndFrom
NumPut(vCtlID, &NMHDR, A_PtrSize=8?8:4, "UPtr") ;idFrom
;NM_DBLCLK := -3 ;0xFFFFFFFD
NumPut(-3, &NMHDR, A_PtrSize=8?16:8, "UInt") ;code
;NM_CLICK := -2 ;0xFFFFFFFE
;NumPut(-2, &NMHDR, A_PtrSize=8?16:8, "UInt") ;code
hWndParent := DllCall("user32\GetAncestor", Ptr,hCtl, UInt,1, Ptr) ;GA_PARENT := 1
;MsgBox, % DllCall("user32\GetDoubleClickTime", UInt) ;500
PostMessage, 0x4E,, % &NMHDR,, % "ahk_id " hWndParent ;WM_NOTIFY := 0x4E
;Sleep, 400
;PostMessage, 0x4E,, % &NMHDR,, % "ahk_id " hWndParent ;WM_NOTIFY := 0x4E
return
- Anyhow, it would be probably better to use ControlClick. @kArThIcK hAcKeR 333: Were you not able to do this via ControlClick (or the 'WM_' messages as in HotKeyIt's example that you posted a link to), once you had the coordinates?