Jump to content

WM CALCVALIDRECTS

From EDM2
Revision as of 22:39, 13 April 2025 by Martini (talk | contribs) (Created page with "This message is sent from WinSetWindowPos and WinSetMultWindowPos to determine which areas of a window can be preserved if a window is sized, and which should be redisplayed. ==Syntax== <PRE> param1 PRECTL pOldNew; Window-rectangle structures.: param2 PSWP pNew; New window position.: </PRE> ==Parameters== ;pOldNew (PRECTL) - Input/Output : This points to two RECTL structures. The first structure contains the rectangle of t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This message is sent from WinSetWindowPos and WinSetMultWindowPos to determine which areas of a window can be preserved if a window is sized, and which should be redisplayed.

Syntax

param1
    PRECTL    pOldNew;  /* Window-rectangle structures. */

param2
    PSWP      pNew;     /* New window position. */

Parameters

pOldNew (PRECTL) - Input/Output
This points to two RECTL structures. The first structure contains the rectangle of the window before the move, the second contains the rectangle of the window after the move. The coordinates of the rectangles are relative to the parent window. The window procedure can modify these rectangles to cause parts of the window to be redrawn and not preserved.
pNew (PSWP) - Input
This points to a SWP structure that contains information about the window after it is resized (see the WinSetWindowPos function).

Returns

usAlign (USHORT) - returns
Alignment control. This instructs WinSetWindowPos how to align valid window bits. This value is made up from CVR_* flags, as follows:
CVR_ALIGNLEFT
Align with the left edge of the window.
CVR_ALIGNBOTTOM
Align with the bottom edge of the window.
CVR_ALIGNTOP
Align with the top edge of the window.
CVR_ALIGNRIGHT
Align with the right edge of the window.
CVR_REDRAW
The whole window is invalid. If CVR_REDRAW is set, the whole window is assumed invalid, otherwise, the remaining flags can be ORed together to get different kinds of alignment. For example:
```c
(CVR_ALIGNLEFT | CVR_ALIGNTOP)
```
aligns the valid window area with the top-left of the window.
0
It is assumed the application has changed the rectangles pointed to by pOldNew and pNew itself.

Remarks

This message is not sent if this window has the CS_SIZEREDRAW style, indicating size-sensitive window content that must be totally redrawn if sized.

This enables the application to determine if the position of the window has changed as well as its size; this can aid alignment processing.

The window manager tries to preserve the screen image by copying the image described by the old rectangle into the image described by the new rectangle. In this way, an application can control the alignment of the preserved image as well, by changing the origin of the first rectangle.

If no change is made to either rectangle, the entire window area is preserved. If either rectangle is empty, the entire window area is completely redrawn by the operation.

Note
This functionality can be used to optimize window updating when the window is resized. For example, if the application returns that the window is to be aligned with the top-left corner, and the top border is sized, the screen data of the window moves with the top border.

In all instances, the rectangles are intersected with the area of the screen that is actually visible and the valid area of the window. That is, only the window area that contains window information is copied.

For example, consider an application that has two scroll bars, that are children of the client window. When the window is resized, the scroll bars must be completely redrawn. By returning rectangles that exclude the scroll bars, the area of the scroll bars is completely redrawn, thereby preserving only the part of the screen that is worth preserving.

Default Processing

The default window procedure processing is to align the valid area with the top-left of the window by returning:

(CVR_ALIGNTOP | CVR_ALIGNLEFT)

In addition, any child windows intersecting the source rectangle pointed to by pOldNew of this message, are also offset with the aligned window area.