PtInRect

The PtInRect function determines whether the specified point lies within the specified 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.

BOOL PtInRect(
  CONST RECT *lprc,  // pointer to structure with rectangle
  POINT pt           // structure with point
);
 

Parameters

lprc
Pointer to a RECT structure that contains the specified rectangle.
pt
Specifies a POINT structure that contains the specified point.

Return Values

If the specified point lies within the rectangle, the return value is nonzero.

If the specified point does not lie within the rectangle, the return value is zero.

Windows NT: To get extended error information, call GetLastError.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.

See Also

Rectangles Overview, Rectangle Functions, EqualRect, IsRectEmpty, POINT, RECT