PtInRegion

2.x

  BOOL PtInRegion(hrgn, nXPos, nYPos)    
  HRGN hrgn; /* handle of region, */  
  int nXPos; /* x-coordinate of point, */  
  int nYPos; /* y-coordinate of point, */  

The PtInRegion function determines whether a specified point is in the given region.

Parameters

hrgn

Identifies the region to be examined.

nXPos

Specifies the logical x-coordinate of the point.

nYPos

Specifies the logical y-coordinate of the point.

Return Value

The return value is nonzero if the point is in the region. Otherwise, it is zero.

Example

The following example uses the PtInRegion function to determine whether the point (50, 50) is in the specified region and prints the result:

HRGN hrgn;
BOOL fPtIn;
LPSTR lpszInRegion = "Specified point is in region.";
LPSTR lpszNotInRegion = "Specified point is not in region.";

fPtIn = PtInRegion(hrgn, 50, 50);
if (!fPtIn)
    TextOut(hdc, 10, 10, lpszNotInRegion,
        lstrlen(lpszNotInRegion));
else
    TextOut(hdc, 10, 10, lpszInRegion, lstrlen(lpszInRegion));

See Also

RectInRegion