pixelsearch Posted November 5, 2020 Share Posted November 5, 2020 (edited) Hi everybody The 2 following tests show a different behavior concerning mouse clicks : First test with 1 window only : expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Example() Func Example() GUICreate("1 Window only", 400, 300) Local $idControl = GUICtrlCreateLabel('Label: Right click for context menu', _ 0, 0, 400, 300, BitOr($SS_CENTERIMAGE, $SS_CENTER)) Local $idContextmenu = GUICtrlCreateContextMenu($idControl) Local $idNewsubmenu = GUICtrlCreateMenu("new", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) Local $iCount = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN $iCount += 1 ConsoleWrite("PrimaryDown " & $iCount & @lf) Case $GUI_EVENT_SECONDARYDOWN $iCount += 1 ConsoleWrite("SecondaryDown " & $iCount & @lf) Case $idNewsubmenuText, $idMenuOpen, $idMenuSave ConsoleWrite("=====> Context option <=====" & @lf) ;~ Case $GUI_EVENT_PRIMARYUP ;~ $iCount += 1 ;~ ConsoleWrite("PrimaryUP " & $iCount & @lf) ;~ Case $GUI_EVENT_SECONDARYUP ;~ $iCount += 1 ;~ ConsoleWrite("SecondaryUP " & $iCount & @lf) EndSwitch WEnd GUIDelete() EndFunc ;==>Example * 1st phase : Right click in the client area A context menu is displayed and Scite console shows : SecondaryDown 1 * 2nd phase : Left click (2-3 times) on disabled context menu option "Info" (or on separator line before option "Info") * 3rd phase : Left click to choose an option in the context menu Scite console shows correctly this : SecondaryDown 1 =====> Context option <===== All this is great, so far so good. Now let's do the 2nd test, with 2 windows (parent / child) : expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Example() Func Example() $hGUI0 = GUICreate("Parent", 500, 400, -1, -1, _ -1, $WS_EX_COMPOSITED) $hGUI1 = GUICreate("Child", 400, 300, 50, 35, _ BitOr($WS_CHILD, $WS_CAPTION), -1, $hGUI0) GUISetBkColor(0xF0F4F9, $hGUI1) Local $idControl = GUICtrlCreateLabel('Label: Right click for context menu', _ 0, 0, 400, 300, BitOr($SS_CENTERIMAGE, $SS_CENTER)) Local $idContextmenu = GUICtrlCreateContextMenu($idControl) Local $idNewsubmenu = GUICtrlCreateMenu("new", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGUI0) GUISetState(@SW_SHOW, $hGUI1) Local $iCount = 0 While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] Case $hGUI0 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN $iCount += 1 ConsoleWrite("PrimaryDown from PARENT " & $iCount & @lf) Case $GUI_EVENT_SECONDARYDOWN $iCount += 1 ConsoleWrite("SecondaryDown from PARENT " & $iCount & @lf) ;~ Case $GUI_EVENT_PRIMARYUP ;~ $iCount += 1 ;~ ConsoleWrite("PrimaryUP from PARENT " & $iCount & @lf) ;~ Case $GUI_EVENT_SECONDARYUP ;~ $iCount += 1 ;~ ConsoleWrite("SecondaryUP from PARENT " & $iCount & @lf) EndSwitch Case $hGUI1 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN $iCount += 1 ConsoleWrite("PrimaryDown from CHILD " & $iCount & @lf) Case $GUI_EVENT_SECONDARYDOWN $iCount += 1 ConsoleWrite("SecondaryDown from CHILD " & $iCount & @lf) Case $idNewsubmenuText, $idMenuOpen, $idMenuSave ConsoleWrite("=====> Context option from CHILD <=====" & @lf) ;~ Case $GUI_EVENT_PRIMARYUP ;~ $iCount += 1 ;~ ConsoleWrite("PrimaryUP from CHILD " & $iCount & @lf) ;~ Case $GUI_EVENT_SECONDARYUP ;~ $iCount += 1 ;~ ConsoleWrite("SecondaryUP from CHILD " & $iCount & @lf) EndSwitch EndSwitch WEnd GUIDelete($hGUI0) GUIDelete($hGUI1) EndFunc ;==>Example * Please do the same 3 phases as before. Then Scite console shows something similar to this : SecondaryDown from PARENT 1 PrimaryDown from PARENT 2 PrimaryDown from PARENT 3 PrimaryDown from PARENT 4 PrimaryDown from PARENT 5 PrimaryDown from PARENT 6 =====> Context option from CHILD <===== My question is : how to "eat" all these superfluous left clicks when the context menu is associated to a control placed in a child GUI ? I would like to intercept them all, so they won't interfere with my Case $GUI_EVENT_PRIMARYDOWN, which is used for other purposes (i.e. display next image if short left-click, crop image if left-click > 250ms etc...) If thoseĀ unnecessary left clicks are not intercepted, then the script will quickly display several images (one per stacked left click) and I really would like to avoid it. I tried to register WM_LBUTTONDOWN, it didn't work. I also tried a flag in Case $GUI_EVENT_SECONDARYDOWN, not enough. Maybe the WM_CONTEXTMENU message could be useful but I'm not really sure. Thanks Edited November 6, 2020 by pixelsearch Title thread changed to [Solved] Link to comment Share on other sites More sharing options...
Nine Posted November 5, 2020 Share Posted November 5, 2020 Here one way : expandcollapse popup#include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <Misc.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Global $hHook, $hStub_MouseProc HotKeySet("{ESC}", _Exit) OnAutoItExitRegister(Cleanup) Example() Func Example() Local $hMod $hStub_MouseProc = DllCallbackRegister(_MouseProc, "long", "int;wparam;lparam") $hMod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_MouseProc), $hMod) While True Sleep(100) WEnd EndFunc ;==>Example Func _MouseProc($nCode, $wParam, $lParam) Local $xevent If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) Local $tMouseHOOKS = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $ptx = DllStructGetData($tMouseHOOKS, "X") Local $pty = DllStructGetData($tMouseHOOKS, "Y") Local $mouseData = DllStructGetData($tMouseHOOKS, "mousedata") Local $flags = DllStructGetData($tMouseHOOKS, "flags") Switch $wParam Case $WM_MOUSEMOVE $xevent = "Mouse Move" Case $WM_MOUSEWHEEL If _WinAPI_HiWord($mouseData) > 0 Then $xevent = "Wheel Forward" Else $xevent = "Wheel Backward" EndIf Case $WM_LBUTTONDOWN Return 1 ; (will block) $xevent = "Left Down" Case $WM_LBUTTONUP Return 1 ; (will block) $xevent = "Left Up" Case $WM_RBUTTONDOWN $xevent = "Right Down" Case $WM_RBUTTONUP $xevent = "Right Up" Case $WM_MBUTTONDBLCLK $xevent = "Double Wheel Click" Case $WM_MBUTTONDOWN $xevent = "Wheel Down" Case $WM_MBUTTONUP $xevent = "Wheel Up" EndSwitch ConsoleWrite($xevent & @CRLF) Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func Cleanup() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_MouseProc) EndFunc ;==>Cleanup Func _Exit() Exit EndFunc ;==>_Exit Ā pixelsearch 1 āThey did not know it was impossible, so they did itāĀ ā Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Ā Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Ā Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC Ā HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Ā Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Ā Printer Manager GIF Animation (cached) Ā Screen Scraping Ā Ā Multi-Threading Made Easy Ā Ā Link to comment Share on other sites More sharing options...
pixelsearch Posted November 5, 2020 Author Share Posted November 5, 2020 @Nine : Gonna try your script and let you know. Thanks for the quick answer Link to comment Share on other sites More sharing options...
pixelsearch Posted November 6, 2020 Author Share Posted November 6, 2020 (edited) Hello Nine I could integrate an amended hook part to my script but as you will notice, _MouseProc() function acts just like a "counter" to know how many unuselful left clicks are stacked. Also if we Return 1 from the function, then any context menu item can't be activated by a left click, which is a bit annoying. Anyway, I post the amended script in case it may help a user having the same issue : expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> OnAutoItExitRegister("_UnHook") Global $hFunc, $pFunc, $hMod, $hHook $hFunc = DllCallbackRegister('_MouseProc', 'lresult', 'int;int;int') $pFunc = DllCallbackGetPtr($hFunc) $hMod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pFunc, $hMod) Global $hGUI0, $iClicksToIgnore = 0, $iWidthChild = 400, $iHeightChild = 300 Example() Func Example() $hGUI0 = GUICreate("Parent", 500, 400, -1, -1, _ -1, $WS_EX_COMPOSITED) Local $hGUI1 = GUICreate("Child", $iWidthChild, $iHeightChild, 50, 35, _ BitOr($WS_CHILD, $WS_CAPTION), -1, $hGUI0) GUISetBkColor(0xF0F4F9, $hGUI1) Local $idControl = GUICtrlCreateLabel('Label: Right click for context menu', _ 0, 0, $iWidthChild, $iHeightChild, BitOr($SS_CENTERIMAGE, $SS_CENTER)) Local $idContextmenu = GUICtrlCreateContextMenu($idControl) Local $idNewsubmenu = GUICtrlCreateMenu("new", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGUI0) GUISetState(@SW_SHOW, $hGUI1) While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] Case $hGUI0 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN If $iClicksToIgnore > 0 Then ConsoleWrite("PrimaryDown from PARENT (ignored) " & $iClicksToIgnore & @lf) $iClicksToIgnore -= 1 ContinueLoop EndIf Local $aPos = GUIGetCursorInfo($hGUI1) If Not IsArray($aPos) _ Or $aPos[0] < 0 Or $aPos[0] > $iWidthChild _ Or $aPos[1] < 0 Or $aPos[1] > $iHeightChild Then ContinueLoop EndIf ConsoleWrite("PrimaryDown from PARENT (real one)" & @lf) EndSwitch Case $hGUI1 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $idNewsubmenuText, $idMenuOpen, $idMenuSave ConsoleWrite("=====> Context option from CHILD <=====" & @lf) EndSwitch EndSwitch WEnd GUIDelete($hGUI0) GUIDelete($hGUI1) EndFunc ;==>Example ;========================================== Func _MouseProc($iCode, $wParam, $lParam) If $iCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $iCode, $wParam, $lParam) Switch $wParam Case $WM_LBUTTONDOWN If WinActive("[ACTIVE]") = $hGUI0 Then ; parent Local $aList = WinList("[CLASS:#32768]") ; context menu is #32768 If $aList[0][0] >= 1 Then ; 1 = context menu visible (2 = context submenu visible too) $iClicksToIgnore += 1 ConsoleWrite("Hook - Left Mouse Down (" & $iClicksToIgnore & " to ignore)" & @lf) ; Return 1 ; will block => context menu option not clickable... EndIf EndIf EndSwitch Return _WinAPI_CallNextHookEx($hHook, $iCode, $wParam, $lParam) EndFunc ;==>_MouseProc ;========================================== Func _UnHook() ConsoleWrite("_UnHook" & @lf) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hFunc) Exit EndFunc ;==>_UnHook Meanwhile I found another way (script below) to solve my problem, by registering WM_COMMAND and it seems ok. How does it work ? It's based on a 3-state flag $iClickStatus, which can be equal to 0, 1, 2 * A right click inside the child GUI (displaying the context menu) forces $iClickStatus = 2 * When WM_COMMAND is triggered (always before Case $GUI_EVENT_PRIMARYDOWN +++) by a left click inside the child GUI, then $iClickStatus = 1 (only if it was = 2) or $iClickStatus = 0 (if it was 1 or 0) * When Case $GUI_EVENT_PRIMARYDOWN is triggered, then we detect if the pending left clicks are useful or not by checking the value of $iClickStatus : => if > 0 : superfluous left click (to be ignored) => if = 0 : real left click (to be processed) * Choosing an item in the context menu forces $iClickStatus = 0 * Clicking inside the parent window (and outside the child window) forces $iClickStatus = 0 expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $hGUI1, $iWidthChild = 400, $iHeightChild = 300 Global $idControl, $hControl, $iControlCaption = 1, $iClickStatus = 0 Example() ;============================================ Func Example() Local $hGUI0 = GUICreate("Parent", 500, 400, -1, -1, _ -1, $WS_EX_COMPOSITED) $hGUI1 = GUICreate("Child", $iWidthChild, $iHeightChild, 50, 35, _ BitOr($WS_CHILD, $WS_CAPTION), -1, $hGUI0) GUISetBkColor(0xF0F4F9, $hGUI1) $idControl = GUICtrlCreateLabel('Label #' & $iControlCaption & ' : Right click for context menu', _ 0, 0, $iWidthChild, $iHeightChild, BitOr($SS_CENTERIMAGE, $SS_CENTER)) $hControl = GUICtrlGetHandle($idControl) Local $idContextmenu = GUICtrlCreateContextMenu($idControl) Local $idNewsubmenu = GUICtrlCreateMenu("new", $idContextmenu) Local $idNewsubmenuText = GUICtrlCreateMenuItem("text", $idNewsubmenu) Local $idMenuOpen = GUICtrlCreateMenuItem("Open", $idContextmenu) Local $idMenuSave = GUICtrlCreateMenuItem("Save", $idContextmenu) GUICtrlCreateMenuItem("", $idContextmenu) ; separator Local $idMenuInfo = GUICtrlCreateMenuItem("Info", $idContextmenu) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGUI0) GUISetState(@SW_SHOW, $hGUI1) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] Case $hGUI0 Switch $aMsg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN Local $aPos = GUIGetCursorInfo($hGUI1) If Not IsArray($aPos) _ Or $aPos[0] < 0 Or $aPos[0] > $iWidthChild _ Or $aPos[1] < 0 Or $aPos[1] > $iHeightChild Then $iClickStatus = 0 ContinueLoop EndIf If $iClickStatus <> 0 Then ConsoleWrite("PrimaryDown from PARENT " & $iClickStatus & " (ignore)" & @lf) Else ConsoleWrite("PrimaryDown from PARENT " & $iClickStatus & " (real)" & @lf) ConsoleWrite("---------------------------" & @lf) $iControlCaption += 1 GUICtrlSetData($idControl, 'Label #' & $iControlCaption) EndIf Case $GUI_EVENT_SECONDARYDOWN $iClickStatus = 2 ConsoleWrite("SecondaryDown from PARENT " & $iClickStatus & @lf) EndSwitch Case $hGUI1 Switch $aMsg[0] Case $idNewsubmenuText, $idMenuOpen, $idMenuSave $iClickStatus = 0 ConsoleWrite("Context option from CHILD " & $iClickStatus & @lf) ConsoleWrite("---------------------------" & @lf) $iControlCaption += 1 GUICtrlSetData($idControl, 'Label #' & $iControlCaption) EndSwitch EndSwitch WEnd GUIDelete($hGUI0) GUIDelete($hGUI1) EndFunc ;==>Example ;============================================ Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $hGUI1 And $lParam = $hControl Then Local $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word Local $iCode = BitShift($wParam, 16) ; Hi Word If $iIDFrom = $idControl And $iCode = $WM_NULL Then $iClickStatus = (($iClickStatus = 2) ? 1 : 0) ConsoleWrite("WM_COMMAND left click " & $iClickStatus & @lf) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND I'm not really sure of the consistency of my Func WM_COMMAND() Could you please let me know if you have an idea concerning the $WM_NULL constant used in WM_COMMAND() ? I found it after having tested the value of $iCode in the function, MSDN stipulating this concerning WM_COMMAND : Message Source can be a menu, an accelerator or a control (in my script it's the label control $idControl which fills the entire child window) When Source is a control, then : * wParam (high word) => Control-defined notification code (which seems to be $WM_NULL in my case) * wParam (low word) => Control identifier * lParam => Handle to the control window (the label control) Thanks for testing this last script and please let me know if you encountered any issue Edited November 6, 2020 by pixelsearch typo Link to comment Share on other sites More sharing options...
LarsJ Posted November 6, 2020 Share Posted November 6, 2020 Can't use an MDICHILD instead? $hGUI1 = GUICreate("Child", 400, 300, 50, 35, $WS_CAPTION, $WS_EX_MDICHILD, $hGUI0) Ā Controls,Ā Ā File Explorer,Ā Ā ROT objects,Ā Ā UI Automation,Ā Ā Windows Message MonitorCompiled code:Ā Accessing AutoIt variables,Ā Ā DotNet.au3 UDF,Ā Ā Using C# and VB codeShell menus:Ā The Context menu, Ā The Favorites menu.Ā Shell related:Ā Control Panel, Ā System Image ListsGraphics related:Ā Rubik's Cube, Ā OpenGL without external libraries,Ā Ā Navigating in an image, Ā Non-rectangular selectionsListView controls:Ā Colors and fonts, Ā Multi-line header,Ā Ā Multi-line items, Ā Checkboxes and icons,Ā Ā Incremental searchListView controls:Ā Virtual ListViews,Ā Ā Editing cells,Ā Ā Data display functions Link to comment Share on other sites More sharing options...
pixelsearch Posted November 6, 2020 Author Share Posted November 6, 2020 Hi LarsJ Thanks for your input, always appreciated Unfortunately I can't use MDICHILD, please have a look at this link where I described exactly the use of the parent & child window in the real script (which is used to resize images), ending with : "But as I added $WS_EX_COMPOSITED to remove all flickering while zooming (and it really works fine), then I'll never remove $WS_EX_COMPOSITED any more." FYI, I just tested your suggestion with MDICHILD and there is a bad stroboscopic effect (flickering) each time the mousewheel is actionned, which is very disturbing. This flickering doesn't exist at all when the child window is created with a $WS_CHILD style. For the record, here is what the help file stipulates, concerning the $WS_EX_COMPOSITED extended style : $WS_EX_COMPOSITED : Paints all descendants of a window in bottom-to-top painting order using double-buffering. So what works really fine with $WS_CHILD windows doesn't seem to have the same behavior with $WS_EX_MDICHILD windows. This is the main interface in the real script (before choosing "Preview" which will create the parent / child windows) Actually everything works really fine (plenty of Accelerators, no context menu) But I wanted now to experiment a context menu and well... we're on the way to solve it Ā Link to comment Share on other sites More sharing options...
Nine Posted November 6, 2020 Share Posted November 6, 2020 I found this, don't know if it can cause you a problem or not, but seems kind of a bug to me.Ā If you right click to get the context menu, decide not to use the menu and click on the label (in real life to perform another task), the click is ignored.Ā Do you think it is a problem ? As for you test (If $iIDFrom = $idControl And $iCode = $WM_NULL Then), I believe it is kind of superfluous since the id ~= handle and icode always 0.Ā But it doesn't hurt. āThey did not know it was impossible, so they did itāĀ ā Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Ā Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Ā Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC Ā HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Ā Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Ā Printer Manager GIF Animation (cached) Ā Screen Scraping Ā Ā Multi-Threading Made Easy Ā Ā Link to comment Share on other sites More sharing options...
pixelsearch Posted November 6, 2020 Author Share Posted November 6, 2020 (edited) Hi Nine, Thanks for your test. 4 hours ago, Nine said: ... Do you think it is a problem ? No absolutely not, it was done by design : it's just a way to cancel a context menu when you don't want to choose any option in it (same as if you key Esc while the context menu is showing), a sort of "ok, let's get rid of this unwanted context menu and re-select our pic" 4 hours ago, Nine said: But it doesn't hurt Exactly ! I thought maybe if $iCode wasn't always equal to $WM_NULL, then at least it would be visible during the test phase. Ok too for "id ~= handle" but as you wrote, it doesn't hurt I found something that should be fixed : * An Immediate right click inside the parent window (outside the child window +++) SecondaryDown from PARENT 2 * Followed by a left click inside the child window WM_COMMAND left click 1 PrimaryDown from PARENT 1 (ignore) Which means that nothing happened when in fact another task should really have been performed. * Of course another left click inside the child window would now fix this : WM_COMMAND left click 0 PrimaryDown from PARENT 0 (real) To solve this (little) issue, let's duplicate a part of the code (copied from Case $GUI_EVENT_PRIMARYDOWN and also found in the real script) ending with : Case $GUI_EVENT_SECONDARYDOWN Local $aPos = GUIGetCursorInfo($hGUI1) If Not IsArray($aPos) _ Or $aPos[0] < 0 Or $aPos[0] > $iWidthChild _ Or $aPos[1] < 0 Or $aPos[1] > $iHeightChild Then $iClickStatus = 0 ContinueLoop EndIf $iClickStatus = 2 ConsoleWrite("SecondaryDown from PARENT " & $iClickStatus & @lf) If you knew the number of messages I tried to register, hoping that one of them would be triggered (like your hook function) so I could intercept or whatever... nothing was triggered. Then finally WM_COMMAND did it, associated to this 3-state flag ($iClickStatus = 0,1,2) . I was lucky to find this solution as it seems reliable for the present script, while not too hard to implement. Fingers crossed Edit: applied those changes to the real script, it works fine. Thanks all Edited November 6, 2020 by pixelsearch Note to indicate that it works fine in real script 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