devoured elysium
devoured elysium

Reputation: 105227

How can I check if a window has WS_VISIBLE to set? (or if is visible)

How can I do it? It's an external window, not from my program. Thanks

Upvotes: 3

Views: 9721

Answers (2)

Jewel S
Jewel S

Reputation:

One nuance to be aware of. IsWindowVisible will return the true visibility state of the window, but that includes the visibility of all parent windows as well.

If you need to check the WS_VISIBLE flag for a specific window you can do GetWindowLong(hWnd, GWL_STYLE) and test for WS_VISIBLE.

... It sounds like you don't need to do this for your case, but adding this for future reference in case others run across this question.

Upvotes: 13

Greg Hewgill
Greg Hewgill

Reputation: 994737

Do you have an HWND to the window? If not, then you will need to obtain the window handle somehow, for example through FindWindow() (or FindWindowEx()).

Once you have the HWND to the window, call IsWindowVisible().

Upvotes: 11

Related Questions