WM_POINTERLEAVE message

Sent to a window when a pointer leaves detection range over the window (hover) or when a pointer moves outside the boundaries of the window.

A window receives this message through its WindowProc function.

![Important]
Desktop apps should be DPI aware. If your app is not DPI aware, screen coordinates contained in pointer messages and related structures might appear inaccurate due to DPI virtualization. DPI virtualization provides automatic scaling support to applications that are not DPI aware and is active by default (users can turn it off). For more information, see Writing High-DPI Win32 Applications.

#define WM_POINTERLEAVE                 0x024A

Parameters

wParam

Contains the pointer identifier and additional information. Use the following macros to retrieve this information.

  • GET_POINTERID_WPARAM(wParam): the pointer identifier.
  • IS_POINTER_INRANGE_WPARAM(wParam): indicates whether this message was generated by a pointer that has not left detection range. This flag is not set when the pointer leaves the detection range of the window.
  • IS_POINTER_INCONTACT_WPARAM(wParam): a flag that indicates whether this message was generated by a pointer that is in contact. This flag is not set for a pointer in detection range (hover).

lParam

Contains the point location of the pointer.

Note

Because the pointer may make contact with the device over a non-trivial area, this point location may be a simplification of a more complex pointer area. Whenever possible, an application should use the complete pointer area information instead of the point location.

Use the following macros to retrieve the physical screen coordinates of the point.

Return value

If an application processes this message, it should return zero.

If the application does not process this message, it should call DefWindowProc.

Remarks

The WM_POINTERLEAVE notification can be used by a window to change mode or stop any feedback to the user while the pointer is over the window surface.

This notification is only sent to the window that is receiving input for the pointer. The following table lists some of the situations in which this notification is sent.

Action Flags Set Notifications Sent To
A hovering pointer crosses window boundaries. IS_POINTER_INRANGE_WPARAM Window outside of whose boundary the pointer moved.
A pointer goes out of detection range. N/A Window for which the pointer leaves detection range.

![Important]
When a window loses capture of a pointer and it receives the WM_POINTERCAPTURECHANGED notification, it typically will not receive any further notifications. For this reason, it is important that you not make any assumptions based on evenly paired WM_POINTERDOWN/WM_POINTERUP or WM_POINTERENTER/WM_POINTERLEAVE notifications.

If contact is maintained with the input digitizer and the pointer moves outside the window, WM_POINTERLEAVE is not generated. WM_POINTERLEAVE is generated only when a hovering pointer crosses window boundaries or contact is terminated.

WM_POINTERLEAVE is posted to the posted message queue if the input is originated from a mouse device.

Requirements

Requirement Value
Minimum supported client
Windows 8 [desktop apps only]
Minimum supported server
Windows Server 2012 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

Messages

Reference

GET_POINTERID_WPARAM

IS_POINTER_INRANGE_WPARAM

IS_POINTER_INCONTACT_WPARAM