PRWIN9012004: MDI Display Bad When App Restored from Icon

ID Number: Q71899

3.00

WINDOWS

buglist3.00 fixlist3.10

Summary:

PROBLEM ID: WIN9012004

SYMPTOMS

When a Windows 3.0 multiple document interface (MDI) application is

started as an icon, iconic child windows are not painted properly.

RESOLUTION

Microsoft has confirmed this to be a problem in Windows version

3.0. To avoid this problem, perform the following four steps:

1. Create the MDI frame window off of the screen with WS_VISIBLE as

one of the window styles.

2. Hide the window by calling ShowWindow with SW_HIDE.

3. Move the hidden frame window on to the desired starting position

of the screen.

4. Show the window at the bottom of the screen by calling

ShowWindow with SW_SHOWMINIMIZED.

This problem was corrected in Windows version 3.1.

More Information:

It is common for MDI applications to create iconic child windows when

the MDI frame window processes the WM_CREATE message. If an

application that uses this technique is initially displayed as an

icon, the application does not behave as expected after it is restored

to normal size. When the MDI application is restored, the MDI client's

vertical scroll bar is shown without any of the MDI children appearing

on the screen. The thumb on the vertical scroll bar is placed at the

bottom. When the thumb is moved to the top of the scroll bar, the

title windows for the MDI children are visible; however, the icons are

not.

The following code fragment implements the resolution detailed above:

/* Create the frame window off of the screen with WS_VISIBLE. */

hwndFrame = CreateWindow(szFrame, szWindowName,

WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE,

-X_LENGTH, -Y_LENGTH, 0, 0,

NULL, NULL, hInst, NULL);

if (!hwndFrame)

return FALSE;

/* Move the frame window on to the screen hidden. */

ShowWindow(hwndFrame, SW_HIDE);

MoveWindow(hwndFrame, X_START, Y_START, X_LENGTH, Y_LENGTH, TRUE);

/* Show the MDI application minimized. */

ShowWindow(hwndFrame, SW_SHOWMINIMIZED);

UpdateWindow(hwndFrame);

Additional reference words: 3.00