Window Visibility
A window can be either visible or hidden. The system displays a visible window on the screen. It hides a hidden window
by not drawing it. If a window is visible, the user can supply input to
the window and view the window's output. If a window is hidden, it is
effectively disabled. A hidden window can process messages from the
system or from other windows, but it cannot process input from the user
or display output. An application sets a window's visibility state when
creating the window. Later, the application can change the visibility
state.
A window is visible when the WS_VISIBLE style is set for the window. By default, the CreateWindowEx
function creates a hidden window unless the application specifies the
WS_VISIBLE style. Typically, an application sets the WS_VISIBLE style
after it has created a window to keep details of the creation process
hidden from the user. For example, an application may keep a new window
hidden while it customizes the window's appearance. If the WS_VISIBLE
style is specified in CreateWindowEx, the system sends the WM_SHOWWINDOW message to the window after creating the window, but before displaying it.
An application can determine whether a window is visible by using the IsWindowVisible function. An application can show (make visible) or hide a window by using the ShowWindow, SetWindowPos, DeferWindowPos, or SetWindowPlacement or SetWindowLong function. These functions show or hide a window by setting or removing the WS_VISIBLE style for the window. They also send the WM_SHOWWINDOW message to the window before showing or hiding it.
When
an owner window is minimized, the system automatically hides the
associated owned windows. Similarly, when an owner window is restored,
the system automatically shows the associated owned windows. In both
cases, the system sends the WM_SHOWWINDOW message to the owned
windows before hiding or showing them. Occasionally, an application may
need to hide the owned windows without having to minimize or hide the
owner. In this case, the application uses the ShowOwnedPopups function. This function sets or removes the WS_VISIBLE style for all owned windows and sends the WM_SHOWWINDOW
message to the owned windows before hiding or showing them. Hiding an
owner window has no effect on the visibility state of the owned windows.
When
a parent window is visible, its associated child windows are also
visible. Similarly, when the parent window is hidden, its child windows
are also hidden. Minimizing the parent window has no effect on the
visibility state of the child windows; that is, the child windows are
minimized along with the parent, but the WS_VISIBLE style is not
changed.
Even if a window has the WS_VISIBLE style, the user may
not be able to see the window on the screen; other windows may
completely overlap it or it may have been moved beyond the edge of the
screen. Also, a visible child window is subject to the clipping rules
established by its parent-child relationship. If the window's parent
window is not visible, it will also not be visible. If the parent
window moves beyond the edge of the screen, the child window also moves
because a child window is drawn relative to the parent's upper left
corner. For example, a user may move the parent window containing the
child window far enough off the edge of the screen that the user may
not be able to see the child window, even though the child window and
its parent window both have the WS_VISIBLE style.
הטקטס לקוח מ