PtInRect

2.x

  BOOL PtInRect(lprc, pt)    
  const RECT FAR* lprc; /* address of structure with rectangle */
  POINT pt; /* structure with point, */  

The PtInRect function determines whether the specified point lies within a given rectangle. A point is within a rectangle if it lies on the left or top side or is within all four sides. A point on the right or bottom side is considered outside the rectangle.

Parameters

lprc

Points to a RECT structure that contains the specified 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.

pt

Specifies a POINT structure that contains the specified point. The POINT structure has the following form:

typedef struct tagPOINT {   /* pt */
   int x;
   int y;
} POINT;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

Return Value

The return value is nonzero if the point lies within the given rectangle. Otherwise, it is zero.

See Also

EqualRect, IsRectEmpty