Displaying a Window (Windows CE 5.0)
You can control the visibility of a window by using the ShowWindow or SetWindowPos function, or by turning the WS_VISIBLE style of the window either on or off by using the SetWindowLong function. You can use the WS_VISIBLE style as a way to hide a window. If this style is turned off, neither the window nor its descendant windows will be drawn on the screen. Even though a child window is hidden when its parent window is hidden, the WS_VISIBLE style of the child window is not changed when the style of its parent window is changed. A child window might have the WS_VISIBLE style turned on and still not be visible if it has a parent window or ancestor window that has the WS_VISIBLE style turned off.
To determine if a window is visible, call the IsWindowVisible function. This function checks the window and its ancestor windows to determine if the window is visible. A window might be considered visible but might not appear on the screen if it is covered by other windows.
By default, the CreateWindowEx function creates a hidden window unless you specify the WS_VISIBLE style. Typically, an application sets the WS_VISIBLE style after it has created a window, so that the application can hide the details of the creation process from the user. For example, an application might keep a new window hidden while it customizes the window appearance.
Changing the visibility of a window does not change automatically the visibility of windows that it owns. Also, if you create a dialog box whose parent window is not visible, the dialog box will be visible. To avoid this inconsistency, do not create a dialog box that is owned by an invisible window.
Windows CE does not have a true minimized state for windows. A window is "minimized" by placing the window behind the desktop. Windows CE also strictly controls how windows move to the foreground. Windows CE allows windows created by a thread to come to the foreground when activated only up to the first call to the GetMessage function or the PeekMessage function. This behavior allows an application to perform the initial operations to create and display a main window without explicitly specifying that the window should be displayed in the foreground. When an application calls GetMessage or PeekMessage, the application can no longer create and display windows in the foreground. If the application destroys the first window, the OS places another window in the foreground. Because the original application is no longer the foreground thread, the OS does not place any windows that the original application subsequently creates in the foreground automatically. Call the SetForegroundWindow function to place these subsequently created windows in the foreground.
See Also
Working with Windows and Messages | GWES Application Development
Send Feedback on this topic to the authors