Jump to content

WinQueryUpdateRegion

From EDM2

This call obtains an update region of a window.

Syntax

WinQueryUpdateRegion(hwnd, hrgn)

Parameters

hwnd (HWND) - Input
Handle of the window whose update region is to be queried.
hrgn (HRGN) - Input
Handle of the region where the window's update region (in window coordinates) will be copied.

Returns

lComplexity (LONG) - returns
Complexity of resulting region/error indicator.
RGN_NULL
Null region.
RGN_RECT
Rectangular region.
RGN_COMPLEX
Complex region.
RGN_ERROR
Error.

Remarks

This function is useful for implementing an alternate update scheme to those used by WinBeginPaint and WinEndPaint, in conjunction with the WinValidateRegion function.

The application can use the returned update region as the clip region for a presentation space, so that drawing output can be clipped to the window's update region.

Errors

Possible returns from WinGetLastError:

  • PMERR_INVALID_HWND (0x1001) - An invalid window handle was specified.
  • PMERR_HRGN_BUSY (0x2034) - An internal region busy error occurred due to concurrent access from different threads.

Example Code

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

HWND    hwnd;         /*  Handle of window whose update region is to be queried. */
HRGN    hrgn;         /*  Handle of the window's update region. */
LONG    lComplexity;  /*  Complexity of resulting region/error indicator. */

lComplexity = WinQueryUpdateRegion(hwnd, hrgn);

This example gets the region that needs to be updated and then repaints the invalid region, if necessary.

#define INCL_WINWINDOWMGR
#define INCL_GPIREGIONS
#include <OS2.H>

HWND hwnd;
HRGN hrgn; /* region handle. */

if (RGN_NULL != WinQueryUpdateRegion(hwnd, hrgn)) {
           /* repaint the invalid region  */
                .
                .
                .

}

This example retrieves the update region of a window and repaints it if necessary.

Related Functions