GetRgnBox

3.0

  int GetRgnBox(hrgn, lprc)    
  HRGN hrgn; /* handle of region, */  
  RECT FAR* lprc; /* address of structure with rectangle */

The GetRgnBox function retrieves the coordinates of the bounding rectangle of the given region.

Parameters

hrgn

Identifies the region.

lprc

Points to a RECT structure that receives the coordinates of the bounding rectangle. 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 SIMPLEREGION (region has no overlapping borders), COMPLEXREGION (region has overlapping borders), or NULLREGION (region is empty), if the function is successful. Otherwise, the return value is ERROR.

Example

The following example uses the GetRgnBox function to determine the type of a region:

RECT rc;
HRGN hrgn;
int RgnType;

RgnType = GetRgnBox(hrgn, &rc);

if (RgnType == COMPLEXREGION)
    TextOut(hdc, 10, 10, "COMPLEXREGION", 13);
else if (RgnType == SIMPLEREGION)
    TextOut(hdc, 10, 10, "SIMPLEREGION", 12);
else
    TextOut(hdc, 10, 10, "NULLREGION", 10);