bab Posted November 12, 2010 Share Posted November 12, 2010 I admit that I do not understand the _wm_notify function. I created a treeview menu for server documentation: +Server1 +backup -filename +baseline -filename +configuration -filename +Server2 +backup -filename +baseline -filename +configuration -filename +Server3 +backup -filename +baseline -filename +configuration -filename I only want the function to respond to a double click on the filenames. Any help would be greatly appreciated. Thank You. ==== Func _WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) ; ConsoleWrite('@@ (28) ' & @MIN & ':' & @SEC & ') WM_NOTIFY()' & @CR) ;### Function Trace Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam); creates a c/c++ style structure, structure is $tagNMHDR, $1Param is the pointer $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom");$tNMHDR is the structure created. $iCode = DllStructGetData($tNMHDR, "Code"); get returned data Switch $hWndFrom Case $hTreeView Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control Local $tPOINT = DllStructCreate("int X;int Y") DllStructSetData($tPOINT, "X", MouseGetPos(0)) DllStructSetData($tPOINT, "Y", MouseGetPos(1)) _ScreenToClient($hTreeView, $tPOINT) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY) If $iItem <> 0 Then $vSelected = _GUICtrlTreeView_GetText($hTreeView, $iItem) & ".pdf" ToolTip($vSelected, 0, 0) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ScreenToClient($hWnd, $tPOINT) ConsoleWrite('@@ (58) ' & @MIN & ':' & @SEC & ') _ScreenToClient()' & @CR) ;### Function Trace Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", "hwnd", $hTreeView, "ptr", DllStructGetPtr($tPOINT)) Return $aRet[0] EndFunc ;==>_ScreenToClient Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 12, 2010 Share Posted November 12, 2010 If you only want double-clicks, why select for $iCode = $NM_CLICK instead of $NM_DBLCLK? After that, you have to see which item was clicked on, then determine if it was a "filename" type or not. The TreeView control doesn't know the difference, so you'll have to figure that out for yourself. On receiving WM_NOTIFY from the TreeView's Hwnd, and with a Code of NM_DBLCLK, you want to get the handle of the selected item and see if that item is in you list of "filenames" or not. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now