CombineRgn

Syntax

int CombineRgn(hDestRgn,hSrcRgn1,hSrcRgn2,nCombineMode)

This function creates a new region by combining two existing regions. The method used to combine the regions is specified by the nCombineMode parameter.

Parameter Type/Description  

hDestRgn HRGN Identifies an existing region that will be replaced by the new region.  
hSrcRgn1 HRGN Identifies an existing region.  
hSrcRgn2 HRGN Identifies an existing region.  
nCombineMode int Specifies the operation to be performed on the two existing regions. It can be any one of the following values:  
  Value Meaning
  RGN_AND Uses overlapping areas of both regions (intersection).
  RGN_COPY Creates a copy of region 1 (identified by hSrcRgn1).
  RGN_DIFF Saves the areas of region 1 (identified by the hSrcRgn1 parameter) that are not part of region 2 (identified by the hSrcRgn2 parameter).
  RGN_OR Combines all of both regions (union).
  RGN_XOR Combines both regions but removes overlapping areas.

Return Value

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

Value Meaning  

COMPLEXREGION New region has overlapping borders.  
ERROR No new region created.  
NULLREGION New region is empty.  
SIMPLEREGION New region has no overlapping borders.  

Comments

If the hDestRgn parameter does not identify an existing region, the application must pass a far pointer to a previously allocated HRGN as the hDestRgn parameter.