The ScrollWindow function scrolls the content of the specified window’s client area. The ScrollWindow function exists for backward compatibility. New applications should use the ScrollWindowEx function.
BOOL ScrollWindow(
HWND hWnd, |
// handle of window to scroll |
int XAmount, |
// amount of horizontal scrolling |
int YAmount, |
// amount of vertical scrolling |
CONST RECT *lpRect, |
// address of structure with scroll rectangle |
CONST RECT *lpClipRect |
// address of structure with clip rectangle |
); |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the caret is in the window being scrolled, ScrollWindow automatically hides the caret to prevent it from being erased and then restores the caret after the scrolling is finished. The caret position is adjusted accordingly.
The area uncovered by ScrollWindow is not repainted, but it is combined into the window’s update region. The application eventually receives a WM_PAINT message notifying it that the region must be repainted. To repaint the uncovered area at the same time the scrolling is in action, call the UpdateWindow function immediately after calling ScrollWindow.
If the lpRect parameter is NULL, the positions of any child windows in the window are offset by the amount specified by the XAmount and YAmount parameters; invalid (unpainted) areas in the window are also offset. ScrollWindow is faster when lpRect is NULL.
If lpRect is not NULL, the positions of child windows are not changed and invalid areas in the window are not offset. To prevent updating problems when lpRect is not NULL, call UpdateWindow to repaint the window before calling ScrollWindow.