int ScrollWindowEx(hwnd, dx, dy, lprcScroll, lprcClip, hrgnUpdate, lprcUpdate, fuScroll) | |||||
HWND hwnd; | /* handle of window to scroll | */ | |||
int dx; | /* amount of horizontal scrolling | */ | |||
int dy; | /* amount of vertical scrolling | */ | |||
const RECT FAR* lprcScroll; | /* address of structure with scroll rect. | */ | |||
const RECT FAR* lprcClip; | /* address of structure with clip rect. | */ | |||
HRGN hrgnUpdate; | /* handle of update region | */ | |||
RECT FAR* lprcUpdate; | /* address of structure for update rect. | */ | |||
UINT fuScroll; | /* scrolling flags, */ |
The ScrollWindowEx function scrolls the contents of a window's client area. This function is similar to the ScrollWindow function, with some additional features.
hwnd
Identifies the window to be scrolled.
dx
Specifies the amount, in device units, of horizontal scrolling. This parameter must be a negative value to scroll to the left.
dy
Specifies the amount, in device units, of vertical scrolling. This parameter must be a negative value to scroll up.
lprcScroll
Points to a RECT structure that specifies the portion of the client area to be scrolled. If this parameter is NULL, the entire client area is scrolled. The RECT structure has the following form:
typedef struct tagRECT { /* rc */
int left;
int top;
int right;
int bottom;
} RECT;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
lprcClip
Points to a RECT structure that specifies the clipping rectangle to scroll. This structure takes precedence over the rectangle pointed to by the lprcScroll parameter. Only bits inside this rectangle are scrolled. Bits outside this rectangle are not affected even if they are in the lprcScroll rectangle. If this parameter is NULL, no clipping is performed on the scroll rectangle.
hrgnUpdate
Identifies the region that is modified to hold the region invalidated by scrolling. This parameter may be NULL.
lprcUpdate
Points to a RECT structure that will receive the boundaries of the rectangle invalidated by scrolling. This parameter may be NULL.
fuScroll
Specifies flags that control scrolling. This parameter can be one of the following values:
Value | Meaning |
SW_ERASE | When specified with SW_INVALIDATE, erases the newly invalidated region by sending a WM_ERASEBKGND message to the window. |
SW_INVALIDATE | Invalidates the region identified by the hrgnUpdate parameter after scrolling. |
SW_SCROLLCHILDREN | Scrolls all child windows that intersect the rectangle pointed to by lprcScroll by the number of pixels specified in the dx and dy parameters. Windows sends a WM_MOVE message to all child windows that intersect lprcScroll, even if they do not move. The caret is repositioned when a child window is scrolled and the cursor rectangle intersects the scroll rectangle. |
The return value is SIMPLEREGION (rectangular invalidated region), COMPLEXREGION (nonrectangular invalidated region; overlapping rectangles), or NULLREGION (no invalidated region), if the function is successful. Otherwise, the return value is ERROR.
If SW_INVALIDATE and SW_ERASE are not specified, ScrollWindowEx does not invalidate the area that is scrolled away from. If either of these flags is set, ScrollWindowEx invalidates this area. The area is not updated until the application calls the UpdateWindow function, calls the RedrawWindow function (specifying RDW_UPDATENOW or RDW_ERASENOW), or retrieves the WM_PAINT message from the application queue.
If the window has the WS_CLIPCHILDREN style, the returned areas specified by hrgnUpdate and lprcUpdate represent the total area of the scrolled window that must be updated, including any areas in child windows that need qupdating.
If the SW_SCROLLCHILDREN flag is specified, Windows will not properly update the screen if part of a child window is scrolled. The part of the scrolled child window that lies outside the source rectangle will not be erased and will not be redrawn properly in its new destination. Use the DeferWindowPos function to move child windows that do not lie completely within the lprcScroll rectangle.
All input and output coordinates (for lprcScroll, lprcClip, lprcUpdate, and hrgnUpdate) are assumed to be in client coordinates, regardless of whether the window has the CS_OWNDC or CS_CLASSDC class style. Use the LPtoDP and DPtoLP functions to convert to and from logical coordinates, if necessary.