Is HWND visible?

蹲街弑〆低调 提交于 2019-12-22 05:53:32

问题


Those darned users and their minimized windows.

In C#, if I have a window's HWND, is there a way to tell if it is visible on the desktop?


回答1:


The GetWindowPlacement function returns a WINDOWPLACEMENT structure which has a field showCmd:

Specifies the current show state of the window.

The details of this read as though you would be setting the window state, but I suspect that this is because they've been copied from somewhere else and not updated.




回答2:


There's the Visible property, but that checks the visible flag, it doesn't tell you whether the window is being covered by another window, or off the screen, etc.. That's a lot more tricky. Raymond Chen has some tips, though:

http://blogs.msdn.com/oldnewthing/archive/2003/09/02/54758.aspx

http://blogs.msdn.com/oldnewthing/archive/2003/08/29/54728.aspx




回答3:


bool isHwndVisible = Control.FromHandle(handle).Visible


来源:https://stackoverflow.com/questions/1738800/is-hwnd-visible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!