Sign in to follow this  
Followers 0
IanN1990

WinGetState Is Visible not working correctly ?

5 posts in this topic

#1 ·  Posted (edited)

; Check if a new notepad window is Visible
Local $state = WinGetState("[CLASS:Notepad]", "")

; Is the "Visible" value set?
If BitAND($state, 2) Then
MsgBox(0, "Example", "Window is Visible")
endif

but it seams to run even if the window is minimized ?

Is this intended?

Edited by IanN1990

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Minimized <> Visible. A window can be visible and minimized or visible and not minimized or hidden and minimized or hidden and not minimized...

; Check if a new notepad window is Visible
Local $state = WinGetState("[CLASS:Notepad]", "")

; Is the "minimized" value set?
If BitAND($state, 2) and not BitAND($state, 16) Then
    MsgBox(0, "Example", "Window is Visible and NOT minimized.")
endif
Edited by KaFu

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I consider "visible" as something you can see. I wouldn't of expected minimized to also count as visible :). If i need two bitand statements, would the following be better ?

; Check if a new notepad window is Visible
Local $state = WinGetState("[CLASS:Notepad]", "")

; Is the "Visible" value set?
If $state = 7 or $state = 15 Then
MsgBox(0, "Example", "Window is Visible")
EndIf

7 = visible

15 = active

Edited by IanN1990

Share this post


Link to post
Share on other sites

Seams your right :D i never considered Maximized would make the code above fail.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0