3

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

devoured elysium
  • 101,373
  • 131
  • 340
  • 557

2 Answers2

13

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.

user229044
  • 232,980
  • 40
  • 330
  • 338
11

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().

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285