CreateRectRgnIndirect

2.x

  HRGN CreateRectRgnIndirect(lprc)    
  const RECT FAR* lprc; /* address of structure with region */

The CreateRectRgnIndirect function creates a rectangular region by using a RECT structure.

Parameters

lprc

Points to a RECT structure that contains the logical coordinates of the upper-left and lower-right corners of the region. 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.

Return Value

The return value is the handle of the rectangular region if the function is successful. Otherwise, it is NULL.

Comments

The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.

When it has finished using a region created by CreateRectRgnIndirect, an application should remove the region by using the DeleteObject function.

Example

The following example assigns values to the members of a RECT structure, uses the CreateRectRgnIndirect function to create a rectangular region, selects the region into a device context, and then uses the PaintRgn function to display the region:

RECT rc;
HRGN hrgn;

SetRect(&rc, 10, 10, 200, 50);

hrgn = CreateRectRgnIndirect(&rc);
SelectObject(hdc, hrgn);
PaintRgn(hdc, hrgn);

See Also

CreateRectRgn, CreateRoundRectRgn, DeleteObject, PaintRgn