Export (0) Print
Expand All
3 out of 8 rated this helpful - Rate this topic

WM_TOUCH message

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

Parameters

wParam

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

lParam

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.

Remarks

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.

Examples

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,
                          cInputs,
                          pInputs,
                          sizeof(TOUCHINPUT)))
    {
        // process pInputs
        if (!CloseTouchInputHandle((HTOUCHINPUT)lParam))
        {
            // error handling
        }
    }
    else
    {
        // GetLastError() and error handling
    }
    delete [] pInputs;
}
else
{
    // error handling, presumably out of memory
}
return DefWindowProc(hWnd, message, wParam, lParam);


Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Winuser.h (include Windows.h)

See also

Messages
Manipulations and Inertia Programming Guide
Windows Touch Input Programming Guide

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.