EvaluateProximityToPolygon function (winuser.h)

Returns the score of a polygon as the probable touch target (compared to all other polygons that intersect the touch contact area) and an adjusted touch point within the polygon.


BOOL EvaluateProximityToPolygon(
        UINT32                                 numVertices,
  [in]  const POINT                            *controlPolygon,
  [in]  const TOUCH_HIT_TESTING_INPUT          *pHitTestingInput,



The number of vertices in the polygon. This value must be greater than or equal to 3.

This value indicates the size of the array, as specified by the controlPolygon parameter.

[in] controlPolygon

The array of x-y screen coordinates that define the shape of the UI element.

The numVertices parameter specifies the number of coordinates.

[in] pHitTestingInput

The TOUCH_HIT_TESTING_INPUT structure that holds the data for the touch contact area.

[out] pProximityEval

The TOUCH_HIT_TESTING_PROXIMITY_EVALUATION structure that holds the score and adjusted touch-point data.

Return value

If this function succeeds, it returns TRUE.

Otherwise, it returns FALSE. To retrieve extended error information, call the GetLastError function.


For consistency with Windows, frameworks that handle WM_TOUCHHITTESTING should use the following principles for targeting:

  • Inclusion: If the touch point is within the boundaries of a control, the touch point is not changed.
  • Intersection: Include only controls that intersect the contact geometry.
  • Z-order: If more than one control intersects the contact geometry, and the controls overlap, the control that's highest in the z-order receives priority.
  • Ambiguity: If more than one control intersects the contact geometry, and the controls don't overlap, the control that's closest to the original touch point receives priority.


Minimum supported client Windows 8 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header winuser.h
Library User32.lib
DLL User32.dll

See also