Cybernetic Posted September 1, 2013 Share Posted September 1, 2013 hey guys. I have this current code which works very well: Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return 0 $code = DllStructGetData($tagNMHDR, 3) If $wParam = $listview1 And $code = -3 Then $double_click = True If $wParam = $listview2 And $code = -3 Then $double_click2 = True Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY It allows me to double click on certain listviews for an effect. What id like to know is, how can i convert or change this code to allow me to double RIGHT click? Any help would be appreciated. Link to comment Share on other sites More sharing options...
FireFox Posted September 1, 2013 Share Posted September 1, 2013 Hi, Here is a proper code for the double click:#include <StructureConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $tNMHDR = 0, $iIDFrom = 0, $iCode = 0 $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $iCode Case $NM_DBLCLK Switch $iIDFrom Case $listview1 $double_click = True Case $listview2 $double_click2 = True EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY I let you find out how to do for the double right click. Br, FireFox. Link to comment Share on other sites More sharing options...
Cybernetic Posted September 1, 2013 Author Share Posted September 1, 2013 Thanks FireFox, but your code is very similiar to mine. And in my code i didn't know how to do it which is why i was asking for help. Could you please show me how to do it? Link to comment Share on other sites More sharing options...
Danyfirex Posted September 2, 2013 Share Posted September 2, 2013 (edited) hi. Maybe this Global Const $WM_RBUTTONDBLCLK = 0x0206 $Gui = GUICreate("doble right click", 400, 400) GUISetState() GUIRegisterMsg($WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK") While 1 $msg = GUIGetMsg() Select Case $msg = -3 Exit EndSelect WEnd Func WM_RBUTTONDBLCLK($hWndGui, $MsgId, $wParam, $lParam) local Static $n=0 $n+=1 Consolewrite( 'Doble Click derecho ' & $n & " veces" & @crlf) EndFunc saludos Edited September 2, 2013 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Solution Danyfirex Posted September 2, 2013 Solution Share Posted September 2, 2013 Also another example with both double right click and double left click expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Ejemplo", 300, 200) local $hListView = GUICtrlCreateListView("Hola |Como|Estas", 2, 2, 290, 100) local $item1 = GUICtrlCreateListViewItem("hola|como|estas", $hListView) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) local Static $nl=1 local Static $nr=1 $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button consolewrite( "$NM_DBLCLK listview " & $nl & @CRLF) ; No return value $nl+=1 Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button consolewrite( "$NM_RDBLCLK listview " & $nr & @CRLF) ; No return value $nr+=1 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Cybernetic Posted September 2, 2013 Author Share Posted September 2, 2013 Also another example with both double right click and double left click expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Ejemplo", 300, 200) local $hListView = GUICtrlCreateListView("Hola |Como|Estas", 2, 2, 290, 100) local $item1 = GUICtrlCreateListViewItem("hola|como|estas", $hListView) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) local Static $nl=1 local Static $nr=1 $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button consolewrite( "$NM_DBLCLK listview " & $nl & @CRLF) ; No return value $nl+=1 Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button consolewrite( "$NM_RDBLCLK listview " & $nr & @CRLF) ; No return value $nr+=1 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY saludos Thanks very much bruz. Link to comment Share on other sites More sharing options...
FireFox Posted September 2, 2013 Share Posted September 2, 2013 Wow, it was very hard to change $NM_DBLCLK to $NM_RDBLCLK in my example... Danyfirex 1 Link to comment Share on other sites More sharing options...
Danyfirex Posted September 2, 2013 Share Posted September 2, 2013 Wow, it was very hard to change $NM_DBLCLK to $NM_RDBLCLK in my example... lol Thanks very much bruz. You're welcome. Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
FireFox Posted September 2, 2013 Share Posted September 2, 2013 (edited) @Cybernetic, I agree that my example does the same thing as yours, however the constants used (and the clear way I wrote it) make it very clear on how to solve the problem and change DBLCLCK to RDBLCLCK. Magic numbers only troubles you that's why you did not understood how it works. It's a pity you asked for the answer and someone cared to give you the solution (no offense to both), but you can't learn by this way. Br, FireFox. Edited September 2, 2013 by FireFox Danyfirex and Xandy 2 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