Jump to content

WinQueryUpdateRect

From EDM2
Revision as of 00:56, 9 April 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the rectangle that bounds the update region of a specified window.

Syntax

WinQueryUpdateRect(hwnd, prclPrc)

Parameters

hwnd (HWND) - Input
Handle of the window whose update rectangle is to be queried.
prclPrc (PRECTL) - Output
Pointer to a RECTL structure that will receive the bounding rectangle of the update region (in window coordinates).
Note: The values in this structure must be between -32768 and 32767. The WRECT data type may also be used if supported by the language.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion.
FALSE
Error occurred, or window has no update region; it is wholly valid, therefore prclPrc is NULL.

Remarks

This function is useful for implementing an incremental update scheme as an alternative to using WinBeginPaint and WinEndPaint.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.

Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND    hwnd;    /* Handle of window. */
RECTL   rclPrc;  /* Rectangle structure. */
BOOL    rc;      /* Success indicator. */

rc = WinQueryUpdateRect(hwnd, &rclPrc);

This example retrieves the update rectangle of a window and then validates it.

#define INCL_WINWINDOWMGR
#include <OS2.H>

HWND  hwnd;
RECTL rcl;
    ...
    ...
    ...
CASE WM_PAINT:

   WinQueryUpdateRect(hwnd, &rcl);
   WinValidateRect(hwnd,&rcl,FALSE);
   WinFillRect(hwnd,&rcl,CLR_RED);
   return 0L;

Related Messages

Related Functions