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?