kjcdude Posted February 7, 2010 Share Posted February 7, 2010 I'm looking for a function that can detect when a window is visible by the human eye. I know that WinGetState() will return if it exists, is "visible", enabled, and active. But that doesn't tell me if the window is covered or if it's visible by the human eye. From the tests I've run it will only return 7 even if the window is covered by another application, even a full screen application. The good thing is the window I'm monitoring is inside a script, so if I need to use a gui function that won't be a problem. Thanks for the help. Link to comment Share on other sites More sharing options...
Steveiwonder Posted February 7, 2010 Share Posted February 7, 2010 I've seen something already for this, you need to fine which window is "Ontop" or is currently "focused".. Will keep looking... They call me MrRegExpMan Link to comment Share on other sites More sharing options...
martin Posted February 7, 2010 Share Posted February 7, 2010 To see if a window is visible maybe you could do something like this. For each corner of the window use WindowFromPoint to see which is the topmost window and then if it is another window get the edges of that window and test where that crosses the border of your window etc. But could you simply force your window to the top using WInSetOnTop? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
kjcdude Posted February 10, 2010 Author Share Posted February 10, 2010 (edited) To see if a window is visible maybe you could do something like this. For each corner of the window use WindowFromPoint to see which is the topmost window and then if it is another window get the edges of that window and test where that crosses the border of your window etc. But could you simply force your window to the top using WInSetOnTop? WindowFromPoint was exactly what I was looking for, worked perfectly. Little example of how I used it. #include <WinAPI.au3> Global $Struct = DllStructCreate($tagPoint) DllStructSetData($Struct, "x", 805) DllStructSetData($Struct, "y", 234) $mhwnd = _WinAPI_WindowFromPoint($Struct) while 1 Pos() $hwnd = _WinAPI_WindowFromPoint($Struct) if $mhwnd <> $hwnd Then MsgBox(0, "", "on top") EndIf ToolTip($hwnd & @CRLF & MouseGetPos(0) & " X " & MouseGetPos(1)) WEnd Func Pos() DllStructSetData($Struct, "x", MouseGetPos(0)) DllStructSetData($Struct, "y", MouseGetPos(1)) EndFunc ;==>Pos Edited February 10, 2010 by kjcdude 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