argumentum Posted July 13, 2019 Share Posted July 13, 2019 (edited) $Gui = GuiCreate("Test", 500, 150) GUISetState() ; so I disable the gui GUISetState(@SW_DISABLE) ; the msgbox is to fake a child gui MsgBox(0,"Clicking parent title flash msgbox","clicking parent client area does not fash msgbox",60,$Gui) ; re-enable the gui GUISetState(@SW_ENABLE) While 1 Switch GUIGetMsg() Case -3 GUIDelete() Exit EndSwitch WEnd I'd like to have the child form flash, as it does, when the title of the parent is clicked, but when I click any part of it and not just the title. I don't know how to do it. Thanks Edited July 14, 2019 by argumentum Solved Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 _WinAPI_FlashWindow (...) or _WinAPI_FlashWindowEx (...) if you want more control “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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 nope. How would I know that the disabled GUI is clicked ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 callback function or register message ? “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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 register message. But I don't know which message. ..or a DLL call..., again, I have no clue. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 It's 5am here. Need to sleep some, I'll check in a few hours... argumentum 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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 ...after trying every GuiRegisterMsg() there is, all is left is a DLL call, but I don't have what to call Should be something to have the canvas be part of the title I'd guess. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 (edited) Look likes it could be working using this : expandcollapse popup#include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" OnAutoItExitRegister("Cleanup") _Main() Func _Main() Global $g_hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") Local $hMod = _WinAPI_GetModuleHandle(0) Global $g_hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($g_hStub_MouseProc), $hMod) Global $Gui = GUICreate("Test", 500, 150) Global $Label = GUICtrlCreateLabel ("", 0, 0, 500, 150) GUISetState() GUISetState(@SW_DISABLE) MsgBox(0, "Clicking parent title flash msgbox", "clicking parent client area does not fash msgbox", 60, $Gui) GUISetState(@SW_ENABLE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _MouseProc($nCode, $wParam, $lParam) Local $xevent If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndIf 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") Select Case $wParam = $WM_LBUTTONDOWN ; return 1 ; (will block) $xevent = "Left Down" Case $wParam = $WM_LBUTTONUP $xevent = "Left Up" ConsoleWrite($xevent & " = " & $ptx & "/" & $pty & @CRLF) If WinExists ("Clicking") Then If GUIGetCursorInfo ($Gui)[4] then _WinAPI_FlashWindowEX (WinGetHandle ("Clicking"),3,3,100) EndIf EndSelect Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc ; =========================================================== Func Cleanup() GUIDelete() _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_MouseProc) EndFunc ;==>Cleanup Needs some cleaning, but you will get the idea...lmk how it goes Edited July 14, 2019 by Nine “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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 (edited) 8 hours ago, Nine said: lmk how it goes expandcollapse popup#include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" OnAutoItExitRegister("Cleanup") Global $_If_DISABLED = 0 ; useless idea of mine, but, gotta try something :) Global $g_hStub_MouseProc, $hMod, $g_hHook Global $Gui, $Label, $Button _Main() Func _Main() $g_hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") $hMod = _WinAPI_GetModuleHandle(0) $g_hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($g_hStub_MouseProc), $hMod) $Gui = GUICreate("Test", 500, 150) $Label = GUICtrlCreateLabel("", 0, 0, 500, 150) GUICtrlSetState($Label, $GUI_HIDE) $Button = GUICtrlCreateButton("MsgBox", 30, 60, 120) GUICtrlCreateCheckbox("a Checkbox", 30, 30) GUISetState() Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "On_FormClose") GUICtrlSetOnEvent($Button, "On_Button") ;~ On_Button() ; MsgBox(0, "Clicking parent title flash msgbox", "clicking parent client area does not fash msgbox", 60, $Gui) While 1 Sleep(100) WEnd EndFunc ;==>_Main Func _MouseProc($nCode, $wParam, $lParam) Local $xevent If $nCode < 0 Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndIf 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") If $_If_DISABLED Then Switch $wParam Case $WM_LBUTTONDOWN ; return 1 ; (will block) $xevent = "Left Down" Case $WM_LBUTTONUP, $WM_RBUTTONUP $xevent = "Left Up" ConsoleWrite($xevent & " = " & $ptx & "/" & $pty & @TAB & $nCode & @TAB & $wParam & @TAB & $lParam & @CRLF) If WinExists("Clicking") Then If GUIGetCursorInfo($Gui)[4] Then _WinAPI_FlashWindowEx(WinGetHandle("Clicking"), 3, 7, 70) EndIf EndSwitch EndIf Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc ; =========================================================== Func Cleanup() GUIDelete() _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_MouseProc) EndFunc ;==>Cleanup Func On_FormClose() Exit EndFunc Func On_Button() GUISetState(@SW_DISABLE) GUICtrlSetState($Label, $GUI_SHOW) ;~ GUICtrlSendMsg($Gui, 11, 0, 0);$WM_SETREDRAW $_If_DISABLED = 1 MsgBox(0, "Clicking parent title flash msgbox", "clicking parent client area does not fash msgbox", 60, $Gui) $_If_DISABLED = 0 ;~ GUICtrlSendMsg($Gui, 11, 1, 0);$WM_SETREDRAW GUICtrlSetState($Label, $GUI_HIDE) GUISetState(@SW_ENABLE) EndFunc ..if you click anything, it flashes, anything. And when I close the MsgBox(), there is no response. Try the mod. above. Controls don't receive the clicking 😕 Edit: hiding the $Label, solved the clicking non-responsive. Didn't see that Edited July 14, 2019 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 Let me get a better version : expandcollapse popup#include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <WinAPIError.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" OnAutoItExitRegister("Cleanup") _Main() Func _Main() Global $g_hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") Local $hMod = _WinAPI_GetModuleHandle(0) Global $g_hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($g_hStub_MouseProc), $hMod) Global $Gui = GUICreate("Test", 500, 150) Local $Button = GUICtrlCreateButton("OK", 220, 100, 60) GUISetState() GUISetState(@SW_DISABLE) MsgBox($MB_SYSTEMMODAL, "Clicking parent title flash", "clicking parent client area NOW does flash !", 60, $Gui) GUISetState(@SW_ENABLE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _MouseProc($nCode, $wParam, $lParam) If $nCode < 0 Or $wParam <> $WM_LBUTTONDOWN Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) Local $tStruct = DllStructCreate($tagPOINT) Local $tMouseHOOKS = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $ptx = DllStructGetData($tMouseHOOKS, "X") Local $pty = DllStructGetData($tMouseHOOKS, "Y") DllStructSetData($tStruct, "x", $ptx) DllStructSetData($tStruct, "y", $pty) If WinExists("Clicking") And _WinAPI_WindowFromPoint($tStruct) = $Gui Then _WinAPI_MessageBeep(1) _WinAPI_FlashWindowEx(WinGetHandle("Clicking"), 3, 5, 100) EndIf Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func Cleanup() GUIDelete() _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_MouseProc) EndFunc ;==>Cleanup argumentum 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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 ...and all this is just for the About window. Can I hook and unhook on the fly, just for About window or it should stay on, and taking processing time ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 It is general hook (not related to any GUI), you just have to manage multiple windows... argumentum 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...
argumentum Posted July 14, 2019 Author Share Posted July 14, 2019 (edited) expandcollapse popup#include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <WinAPIError.au3> Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" OnAutoItExitRegister("Cleanup") _Main() Func _Main() Global $Gui = GUICreate("Test", 500, 150) Local $Button = GUICtrlCreateButton("OK", 220, 100, 60) GUISetState() MsgBoxEr() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button MsgBoxEr() EndSwitch WEnd EndFunc ;==>_Main Func MsgBoxEr() ; moving the mouse over the area, goes from 0.10~0.20 w/o hook, to 0.60~0.70 with the hook Global $g_hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") Local $hMod = _WinAPI_GetModuleHandle(0) Global $g_hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($g_hStub_MouseProc), $hMod) GUISetState(@SW_DISABLE) MsgBox($MB_SYSTEMMODAL, "Clicking parent title flash", "clicking parent client area NOW does flash !", 60, $Gui) GUISetState(@SW_ENABLE) _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_MouseProc) EndFunc Func _MouseProc($nCode, $wParam, $lParam) If $nCode < 0 Or ( $wParam <> $WM_LBUTTONDOWN And $wParam <> $WM_RBUTTONDOWN ) Then Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) Local $tStruct = DllStructCreate($tagPOINT) Local $tMouseHOOKS = DllStructCreate($tagMSLLHOOKSTRUCT, $lParam) Local $ptx = DllStructGetData($tMouseHOOKS, "X") Local $pty = DllStructGetData($tMouseHOOKS, "Y") DllStructSetData($tStruct, "x", $ptx) DllStructSetData($tStruct, "y", $pty) If WinExists("Clicking") And _WinAPI_WindowFromPoint($tStruct) = $Gui Then _WinAPI_MessageBeep(1) _WinAPI_FlashWindowEx(WinGetHandle("Clicking"), 3, 6, 100) EndIf Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func Cleanup() GUIDelete() ;~ _WinAPI_UnhookWindowsHookEx($g_hHook) ;~ DllCallbackFree($g_hStub_MouseProc) EndFunc ;==>Cleanup I believe this is better, as it uses an extra 0.60 of CPU from a base of 0.10 ( as seen in "Process Explorer" ), while I move the mouse around in circles around the GUI. Let me know if this ON/OFF is flawed, thanks Edit: it does leak some memory but is barely notable. Edited July 14, 2019 by argumentum mistake in the code I poted Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted July 14, 2019 Share Posted July 14, 2019 The hook captures every single action of the mouse. That is why you get a higher proc usage when moving the mouse. But hooking and unhooking is not what I would do...To save few CPU cycles. argumentum 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...
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