Raik Posted April 20, 2012 Posted April 20, 2012 (edited) I have a little Script to monitor my Wlan-Router, witch is set @SW_SHOWNA. On Mouseover it hides, if not Shift is pressed, to allow Control of underlying windows (browsertabs for instance). i want to detect, if firefox or iron is the underlying window and if so, move the gui to another place. GUIRegisterMsg($WM_SETCURSOR, "WM_SETCURSOR") Func WM_SETCURSOR($hWnd, $Msg, $wParam, $lParam) Local Enum $SHIFT, $CTRL, $ALT $accel = DllCall('user32.dll', "short", "GetAsyncKeyState", "int", '0x1' & $SHIFT) If @error Then return If BitAND($accel[0], 0x8000) = 0 Then GUISetState(@SW_HIDE) $mpos=MouseGetPos() Sleep(100) Local $iHwnd = DllCall("user32.dll", "int", "WindowFromPoint", "long", $mpos[0], "long", $mpos[1]) If IsArray($iHwnd) Then $tName = DllStructCreate("CHAR[260]") Local $iRet = DllCall("user32.dll", _ "int", "GetWindowModuleFileName", _ "hwnd", $iHwnd[0], _ "ptr", DllStructGetPtr($tName), _ "uint", DllStructGetSize($tName)) $iHwnd = 0 Tooltip(DllStructGetData($tName,1)) EndIf $pos=WinGetPos($GUI) While $pos[0] <= $mpos[0] And $mpos[0] <= ($pos[0] + $pos[2]) And $pos[1] <= $mpos[1] And $mpos[1] <= ($pos[1] + $pos[3]) Sleep(150) $mpos=MouseGetPos() Wend GUISetState(@SW_SHOWNA) EndIf EndFunc Documentation states "The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is within the window." but my Code alway returns the AutoIt.exe-Path, altrough the Gui is in "hidden"-State. What is wrong with my Code? Edited April 20, 2012 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)
PhoenixXL Posted April 21, 2012 Posted April 21, 2012 If u just want to get the Handle of the window below your GUI U can just hide ur GUI and get the handle of the window beneath it I just tried to help u out , if i get any more good solution i will get it 2 u My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Raik Posted April 21, 2012 Author Posted April 21, 2012 (edited) U can just hide ur GUI and get the handle of the window beneath it thats what i did: [...] GUISetState(@SW_HIDE) $mpos=MouseGetPos() Local $iHwnd = DllCall("user32.dll", "int", "WindowFromPoint", "long", $mpos[0], "long", $mpos[1]) returns the autoit.exe-path.handle Edited April 21, 2012 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)
Raik Posted April 21, 2012 Author Posted April 21, 2012 After reading comments in msdn this func is useless, because it works not always the expected way. i give up for now on this topic. AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)
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