IsWindowVisible Function

The IsWindowVisible function determines whether a specified window, its parent window, its owner's parent window, and so on, are visible. A window is declared visible if it is not the child of another window that is hidden. Note that a window created by CreateWindow, but not yet shown by ShowWindow or SetWindowPos, is not visible.

Syntax


BOOL IsWindowVisible(
  [in] HWND  hWnd
);
            

Parameters

Parameter Type Description
hWnd [in] HWND A handle to the window to be tested.

Return value

Type Description
BOOL If the function succeeds, the return value is one of the following values:
  • TRUE: The window is visible.
  • FALSE: The window is not visible. If GetLastError returns ERROR_INVALID_WINDOW_HANDLE, the window handle is invalid.

Remarks

A window is considered visible if it's not the child of another window that is hidden. This means that even if a window itself has not had ShowWindow(hWnd, SW_HIDE) called on it, it can still be considered invisible if its parent window is hidden.

You can use IsWindowVisible to determine whether a window is visible, regardless of whether it is minimized, maximized, or displayed normally. It is more reliable than checking window styles, as styles can be changed dynamically.

Important: A window created with CreateWindow but not yet shown using ShowWindow or SetWindowPos is considered invisible.

Requirements

Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header winuser.h
Library User32.lib
DLL User32.dll

See also