Get active window's WindowState (Minimized, Normal, Maximized)

How can I retrieve the current windowState? I need to determine (but not change) a window state on my desktop.

I have seen that GetAttribute “Visibility” is a suggested ooption but I cannot find the definitions for the visibility property (e.g. what is 0, what is 3, what other values could this attribute return).

1 Like

Hi,

We can get it from WndStyles attribute using Get Attribute activity.

In the document, the below value is defined, for example.

WS_MINIMIZE 0x20000000L
WS_MAXIMIZE 0x01000000L

So we can check it as the following condition. Let’s say the attribute value is WndStyle

Check maximized

(Int64.Parse(WndStyle) And &H01000000)<>0

Check minimized

(Int64.Parse(WndStyle) And &H20000000)<>0

Regards,

3 Likes

@Yoichi, Thank you for responding.

For my case, working with a Java app, I used the Get Attribute activity to retrieve “wndStyles” and output the result to a variable (WndStyle (declared as Int32)). I used the following test:

Check if maximized:

(WndStyle And &H01000000)<>0

I could not have done this without your guidance. Again, thank you!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.