Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Mobile PC
Mobile PC
 Touch Input Support in Windows Vist...
Touch Input Support in Windows Vista

Windows Vista has new support for touch input on Tablet PC's with touch capable digitizers, including enhanced user interface to aid in targeting and commanding Windows when using a finger for input.

Touch Digitizer Support

Pen and Touch Input Not Exclusive

You should not assume pen and touch input are mutually exclusive in InkCollector, InkOverlay and RealTimeStylus applications.

In Windows Vista, the appearance of the pen will trump touch input. That is, you will see the touch stroke end and the pen stroke begin. However, this could possibly change in the future, and simultaneous touch and pen input may be supported. Therefore, your code should not assume pen and touch input are mutually exclusive.

Other Mouse Message Sources

There are other sources of mouse messages even when the user is only interacting using finger or pen. Sources include touchpads, as well as movement intended to let an application behind a layered window be aware that the mouse is moving above the application.

Enabling and Disabling the Touch Input User Interface

You may wish to enable or disable the touch input user interface depending on the requirements of your application. To accomplish this, intercept operating system window messages in a window procedure and modify the Windows message. Override WndProc in your application to intercept these messages. The following C# pseudo-code shows how to enable and disable the touch input user interface. It also shows using the same technique to disable the press-and-hold gesture. This will also work for the stylus.

C#
const int WM_TABLET_QUERY_SYSTEM_GESTURE_STATUS = 716;

const uint SYSTEM_GESTURE_STATUS_NOHOLD           = 0x00000001;
const uint SYSTEM_GESTURE_STATUS_TOUCHUI_FORCEON  = 0x00000100;
const uint SYSTEM_GESTURE_STATUS_TOUCHUI_FORCEOFF = 0x00000200;

protected override void WndProc(ref Message msg)
{
    switch (msg.Msg)
    {
        case WM_TABLET_QUERY_SYSTEM_GESTURE_STATUS:
        {
            uint result = 0;
            if (...)
            {
                result |= SYSTEM_GESTURE_STATUS_NOHOLD;
            }

            if (...)
            {
                result |= SYSTEM_GESTURE_STATUS_TOUCHUI_FORCEON;
            }

            if (...)
            {
                result |= SYSTEM_GESTURE_STATUS_TOUCHUI_FORCEOFF;
            }

            msg.Result = (IntPtr)result;
        }
        break;

        default:
            base.WndProc(ref msg);
            break;
    }
}
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker