qwert Posted March 25, 2019 Share Posted March 25, 2019 (edited) Normally, double-clicking on an input control highlights any existing contents. But I need to intercept the double click and perform a different action. I've used methods for Listviews ... and the following will return an indicator for a label: Func WM_COMMAND($hWnd, $MsgID, $wParam, $lParam) Local Const $STN_DBLCLK = 1 Local $nID = BitAND($wParam, 0xFFFF) Local $nNotifyCode = BitShift($wParam, 16) If $nID = $label And $nNotifyCode = $STN_DBLCLK Then $DoubleClick = 1 Return $GUI_RUNDEFMSG EndFunc But I haven't been able to detect the double click on an input control. Any suggestions will be greatly appreciated. Thanks in advance. Edited March 25, 2019 by qwert Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 25, 2019 Share Posted March 25, 2019 @qwertHere it is an example Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
qwert Posted March 25, 2019 Author Share Posted March 25, 2019 Thanks for that solution! For anyone following this, I optimized it for multiple inputs by creating handles when the inputs were created: Global $hEdit1 = GUICtrlGetHandle($edit1) Global $hEdit2 = GUICtrlGetHandle($edit2) ; create handles for every input Global $hEdit3 = GUICtrlGetHandle($edit3) I then turned the processing around in the associated function to be more efficient: Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_LBUTTONDBLCLK Switch $hWnd Case $hEdit1 $DoubleClick = $Edit1 Return 0 Case $hEdit2 $DoubleClick = $Edit2 Return 0 : : The function returns the control ID that was double-clicked and everything works as I need. I appreciate the help! Velislav 1 Link to comment Share on other sites More sharing options...
caramen Posted March 25, 2019 Share Posted March 25, 2019 (edited) Here is an exemple of detecting double click in a listview too maybe it can help expandcollapse popupFunc WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) If $WMNotifyTest = 1 Then ConsoleWrite ("; WMNotify () Is Working!!"&@CRLF) $WMNotifyTest += 1 EndIf #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ; Local $tBuffer $hWndListView = $Console If Not IsHWnd($Console) Then $hWndListView = GUICtrlGetHandle($Console) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) _DebugPrint("$NM_CLICK" & @CRLF & _ $TextFav = _GUICtrlListView_GetItemText($Console, DllStructGetData($tInfo, "Index")) & _ "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) ; No return value Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) ClipPut(_GUICtrlListView_GetItemText($Console, DllStructGetData($tInfo, "Index"))) _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) ; No return value Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) _GUICtrlListView_DeleteItem($Console, DllStructGetData($tInfo, "Index")) _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Log.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log02.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _FileWriteToLine ( @ScriptDir&"\Data\Log002.txt" , DllStructGetData($tInfo, "Index") , "" , True , True ) _DebugPrint("$NM_RDBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @CRLF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @CRLF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @CRLF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @CRLF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @CRLF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @CRLF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @CRLF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @CRLF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) ;~ FileClose ($File2) ;~ FileClose ($File02) ;~ FileClose ($File002) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY i dont made this code but i swapped all my need by tuching 1 $var named : $hWndListView to $Console Edited March 25, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
qwert Posted March 25, 2019 Author Share Posted March 25, 2019 Quote I've used methods for Listviews Yes, I've been able to have doubleclicks work for Listviews by detecting $NM_DBLCLK ... but for a reason I'll never fathom, the OS only makes that flag apply to Listviews. Thanks for your response. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 25, 2019 Share Posted March 25, 2019 @qwert Happy to have helped Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette 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