PRB: No Scroll Bars Displayed in an MDI Child Window

ID Number: Q76533

3.00

WINDOWS

Summary:

SYMPTOMS

When a Windows multiple document interface (MDI) child window is

created and the style field of the MDICREATESTRUCT contains

WS_HSCROLL and/or WS_VSCROLL, no scroll bar is displayed.

CAUSE

The scroll bar scroll range has not been set.

RESOLUTION

Set the scroll range to a nonzero interval.

More Information:

The scroll range can be set during the processing of the WM_CREATE

message or in response to a user action when the object to be

displayed extends beyond the window. The following code sets the

scroll range:

// hWnd is the handle to the MDI child window.

// 0 is the minimum scrolling position

// 100 is the maximum scrolling position

// set horizontal scroll bar range.

SetScrollRange(hWnd, SB_HORZ, 0, 100, TRUE);

// set vertical scroll bar range.

SetScrollRange(hWnd, SB_VERT, 0, 100, TRUE);

The scroll bar scroll range can be set to any nonzero interval

provided that the difference between the maximum scrolling position

and the minimum scrolling position is not greater than 32,767.

Note: There is a problem in Windows 3.0 that causes an unrecoverable

application error (UAE) if an MDI child window with scroll bars has

the WS_MAXIMIZE style. For more information, query on the words:

prod(winsdk) and ws_maximize

Additional reference words: 3.0