CombineRgn

  int CombineRgn(hrgnDest, hrgnSrc1, hrgnSrc2, fnCombineMode)    
  HRGN hrgnDest; /* handle of destination region */
  HRGN hrgnSrc1; /* handle of source region */
  HRGN hrgnSrc2; /* handle of source region */
  int fnCombineMode; /* region combining mode */

The CombineRgn function combines two existing regions and stores the result in a third region. The two regions are combined according to the given flag.

Parameters

hrgnDest

Identifies a new region with dimensions that are defined by combining two other regions. (This region must exist prior to calling the CombineRgn function.)

hrgnSrc1

Identifies the first of two regions that will be combined to produce a new region.

hrgnSrc2

Identifies the second of two regions that will be combined to produce a new region.

fnCombineMode

Specifies how the two regions will be combined. It can be any one of the following values:

Flag Meaning

RGN_AND The final region is the intersection of the two combined regions.
RGN_COPY The final region is a copy of the region that is identified by hrgnSrc1.
RGN_DIFF The final region consists of those parts of hrgnSrc1 which are not part of hrgnSrc2.
RGN_OR The final region is the union of the two combined regions.
RGN_XOR The final region is the union of the two combined regions except for the overlapping areas.

Return Value

The return value specifies the type of the resulting region. It can be any one of the following values:

NULLREGION New region is empty.
SIMPLEREGION New region is a single rectangle.
COMPLEXREGION New region is more than a single rectangle.
ERROR No new region created.

Comment

The three regions do not have to be distinct. For example hrgnSrc1 can equal hrgnDest.