Troubleshooting Applications

This section gives solutions to common problems.

General Troubleshooting

Category Description
Issue I am running Windows Server 2008 and Windows Touch features are not working.
Cause You haven't enabled the Desktop Experience.
Solution Open the Server Manager administrative tool: click Start, point to Administrative Tools, and then click Server Manager. Click the Features item in the left column. Click Add Features in the Features section. Select Desktop Experience, click Next, and then click Install.

 

Category Description
Issue Whenever I move my finger quickly across my application, an arrow appears and my gesture or manipulation is not registering correctly.
Cause Having flicks enabled when you don't need it.
Solution You have flicks enabled when you want it to be disabled. See Legacy Support for Panning with Scrollbars for information on disabling pen flicks.

 

Issue I can't discern between mouse input and Windows Touch input.
Cause Windows generates mouse messages for legacy support when a user clicks on the screen.
Solution You can call GetMessageExtraInfo for the WM_LBUTTONDOWN and WM_LBUTTONUP messages to determine the source. The following code shows how this could be done.

C++
#define MOUSEEVENTF_FROMTOUCH 0xFF515700

if ((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) { // Click was generated by wisptis / Windows Touch }else{ // Click was generated by the mouse. }

 

Category Description
Issue How do I run Microsoft PixelSense applications on Windows 7?
Cause Windows Touch and Microsoft PixelSense are incompatible.
Solution You either need to target the Windows 7 platform or Microsoft PixelSense platform.

 

Troubleshooting Manipulations and Inertia

Category Description
Issue My application is freezing for no reason. I'm getting access violations when I initialize my object interfaces.
Cause Missing a call to CoInitialize when using the IManipulationProcessor or IInertiaProcessor interfaces.
Solution This could be caused by instantiating the Windows Touch Component Object Model (COM) objects without calling CoInitialize. This happens sometimes when you are converting projects from using gestures to using the manipulations or inertia interfaces.

 

Category Description
Issue My object is rotating improperly when it's being translated. Single-finger rotation is not working correctly.
Cause Improperly setting pivots on an object.
Solution You are not setting up the manipulation pivot points correctly. Set the PivotPointX and PivotPointY properties to the center of the object or point you want to rotate around, and set the PivotRadius property to the radius of your object.

 

Troubleshooting Windows Touch Input

Category Description
Issue After I handle the WM_TOUCH message, I stop getting boundary feedback.
Cause Consuming the WM_TOUCH message without handling it.
Solution You are probably consuming a Windows Touch message without forwarding it to DefWindowProc, which will result in unexpected behavior. Check Getting Started with Windows Touch Messages for more information on how to properly handle WM_TOUCH messages.

 

Issue I am including windows.h, but it still says that WM_TOUCH is not defined.
Cause The Windows version in Targetver.h is incorrect.
Solution You haven't set the correct Windows version in your project. The following code illustrates the properly set Windows versions for Windows Touch in Windows 7.
C++
#ifndef WINVER                  // Specify that the minimum required platform is Windows 7.
#define WINVER 0x0601           
#endif

 

Issue My touch input x-coordinates and y-coordinates seem invalid. They are either larger values than I expect or they are negative values.
Cause You may need to convert your touch points to pixels, or you may need to convert the screen coordinates.
Solution Make sure that you are calling TOUCH_COORD_TO_PIXEL and ScreenToClient. The following code shows how to do this.
C++
      POINT ptInput;
      if (GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))){
        for (int i=0; i < static_cast<INT>(cInputs); i++){
          TOUCHINPUT ti = pInputs[i];                       
          if (ti.dwID != 0){                
            // Do something with your touch input handle.
            ptInput.x = TOUCH_COORD_TO_PIXEL(ti.x);
            ptInput.y = TOUCH_COORD_TO_PIXEL(ti.y);
            ScreenToClient(hWnd, &ptInput);
            points[ti.dwID][0] = ptInput.x;
            points[ti.dwID][1] = ptInput.y;
          }
        }
      }

Note:
In order to use the ScreenToClient function, you must have high DPI support in your application. For more information on supporting high DPI, visit the High DPI section of MSDN.

 

 

Category Description
Issue I'm not seeing WM_TOUCH messages, but I know that Windows Touch is working because I'm seeing WM_GESTURE messages.
Cause Missing a call to RegisterTouchWindow.
Solution WM_TOUCH and WM_GESTURE messages are mutually exclusive. If you don't call RegisterTouchWindow, you will receive only WM_GESTURE messages.

 

Category Description
Issue I am noticing small delays from the time I touch my finger down to when I am getting input in my application.
Cause Palm rejection is causing delays in input.
Solution If TWF_WANTPALM is set in calls to RegisterTouchWindow, palm rejection is enabled. This causes a small (100 ms) delay while the software tests whether input is coming from a finger, pen, or the user's palm. Disable palm rejection by calling RegisterTouchWindow with the TWF_WANTPALM flag cleared.

 

Troubleshooting Windows Touch Gestures

Category Description
Issue After handling the WM_GESTURE message, I stop getting boundary feedback. Or, a gesture that worked previously does not work now.
Cause Consuming the WM_GESTURE message without handling it.
Solution You are probably consuming a Windows Touch message without forwarding it to DefWindowProc, which will result in unexpected behavior. Check Getting Started with Windows Gestures for more information on how to properly handle WM_GESTURE messages.

 

Category Description
Issue I'm not seeing WM_GESTURE messages, but I know that Windows Touch is working because I'm seeing WM_TOUCH messages.
Cause Calling RegisterTouchWindow.
Solution WM_TOUCH and WM_GESTURE messages are mutually exclusive. If you call RegisterTouchWindow, you will not receive WM_GESTURE messages.

 

Issue I'm not seeing all of the gestures that I expect to see. For example, I'm seeing gestures with the identifier GID_PAN but not GID_ROTATE.
Cause Some gestures, such as the rotate gesture, are not enabled by default.
Solution You need to call SetGestureConfig when you receive a WM_GESTURENOTIFY message as described in the WM_GESTURENOTIFY reference, or you need to add a handler for the WM_GESTURENOTIFY message. The following code shows how a handler could be implemented to enable support for rotation.

C++
// The message map.
BEGIN_MESSAGE_MAP()
    ON_WM_CREATE()
     ... ... ...
    ON_MESSAGE(WM_GESTURENOTIFY, OnWindowsGestureNotify)
END_MESSAGE_MAP()  

LRESULT CTestWndApp::OnWindowsGestureNotify( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ){ GESTURECONFIG gc; gc.dwID = GID_ROTATE; // The gesture identifier. gc.dwWant = GC_ROTATE; // The gesture command you are enabling for GID_ROTATE. gc.dwBlock = 0; // Don't block anything. UINT uiGcs = 1; // The number of gestures being set.

BOOL bResult = SetGestureConfig(g_hMainWnd, 0, uiGcs, &gc, sizeof(GESTURECONFIG)); if(!bResult) { // Something went wrong, report the error using your preferred logging. }

return 0; }

For more examples of typical gesture configurations, see SetGestureConfig.

 

Category Description
Issue The custom scroll bars in my application are not scrolling when I perform the pan gesture.
Cause Missing handlers for the correct WM_*SCROLL messages.
Solution You are not handling all of the WM_*SCROLL messages in your custom scroll bars. It is recommended that you handle the WM_GESTURE message rather than retain custom scrollbar functionality through legacy support. You need to support messages as detailed in the section Legacy Support for Panning with Scroll bars.

 

Category Description
Issue I am getting delays for gestures.
Cause Flicks may be causing delays for gestures.
Solution Flicks can cause delays for how long it takes for your application to receive WM_GESTURE messages. See Legacy Support for Panning with Scrollbars for information on disabling flicks.

 

Programming Guide