directedition
directedition

Reputation: 11705

Is HWND visible?

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?

Upvotes: 6

Views: 2824

Answers (3)

Tim Sylvester
Tim Sylvester

Reputation: 23168

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:

Upvotes: 3

ChrisF
ChrisF

Reputation: 137178

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.

Upvotes: 5

Lee
Lee

Reputation: 144206

bool isHwndVisible = Control.FromHandle(handle).Visible

Upvotes: 1

Related Questions