WM_TOUCH message

Notifies the window when one or more touch points, such as a finger or pen, touches a touch-sensitive digitizer surface.



The low-order word contains the number of touch points associated with this message. The high-order word is reserved for future use.


Contains a touch input handle that can be used in a call to GetTouchInputInfo to retrieve detailed information about the touch points associated with this message.

This handle is valid only within the current process and should not be passed cross-process except as the LPARAM in a SendMessage or PostMessage call.

When the application no longer requires this handle, the application must call CloseTouchInputHandle to free the process memory associated with this handle. Failing to do so can result in an application memory leak.

Note that the touch input handle in this parameter is no longer valid after the message has been passed to DefWindowProc. DefWindowProc will close and invalidate this handle.

Note also that the touch input handle in this parameter is no longer valid after the message has been forwarded using PostMessage, SendMessage, or one of their variants. These functions will close and invalidate this handle.

Return value

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

If the application does not process the message, it must call DefWindowProc. Not doing so causes the application to leak memory because the touch input handle is not closed and associated process memory is not freed.


WM_TOUCH messages do not respect HTTRANSPARENT regions of windows. If a window returns HTTRANSPARENT in response to a WM_NCHITTEST message, mouse messages go to the parent, and WM_TOUCH messages go directly to the window.


The following code is an example of how to obtain detailed touch input information associated with this message.

UINT cInputs = LOWORD(wParam);
PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
if (NULL != pInputs)
    if (GetTouchInputInfo((HTOUCHINPUT)lParam,
        // process pInputs
        if (!CloseTouchInputHandle((HTOUCHINPUT)lParam))
            // error handling
        // GetLastError() and error handling
    delete [] pInputs;
    // error handling, presumably out of memory
return DefWindowProc(hWnd, message, wParam, lParam);


Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
Windows Server 2008 R2 [desktop apps only]
Winuser.h (include Windows.h)

See also


Manipulations and Inertia Programming Guide

Windows Touch Input Programming Guide