Troubleshooting Applications

This section gives solutions to common problems.

General Troubleshooting

IssueI am running Windows Server 2008 and Windows Touch features are not working.
CauseYou haven't enabled the Desktop Experience.
SolutionOpen 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.

 

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

 

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


#define MOUSEEVENTF_FROMTOUCH 0xFF515700

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



 

IssueHow do I run Microsoft PixelSense applications on Windows 7?
CauseWindows Touch and Microsoft PixelSense are incompatible.
SolutionYou either need to target the Windows 7 platform or Microsoft PixelSense platform.

 

Troubleshooting Manipulations and Inertia

IssueMy application is freezing for no reason. I'm getting access violations when I initialize my object interfaces.
CauseMissing a call to CoInitialize when using the IManipulationProcessor or IInertiaProcessor interfaces.
SolutionThis 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.

 

IssueMy object is rotating improperly when it's being translated. Single-finger rotation is not working correctly.
CauseImproperly setting pivots on an object.
SolutionYou 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

IssueAfter I handle the WM_TOUCH message, I stop getting boundary feedback.
CauseConsuming the WM_TOUCH message without handling it.
SolutionYou 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.

 

IssueI am including windows.h, but it still says that WM_TOUCH is not defined.
CauseThe Windows version in Targetver.h is incorrect.
SolutionYou 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.


#ifndef WINVER                  // Specify that the minimum required platform is Windows 7.
#define WINVER 0x0601           
#endif


 

IssueMy touch input x-coordinates and y-coordinates seem invalid. They are either larger values than I expect or they are negative values.
CauseYou may need to convert your touch points to pixels, or you may need to convert the screen coordinates.
SolutionMake sure that you are calling TOUCH_COORD_TO_PIXEL and ScreenToClient. The following code shows how to do this.


      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.

 

IssueI'm not seeing WM_TOUCH messages, but I know that Windows Touch is working because I'm seeing WM_GESTURE messages.
CauseMissing 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.

 

IssueI am noticing small delays from the time I touch my finger down to when I am getting input in my application.
CausePalm rejection is causing delays in input.
SolutionIf 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

IssueAfter handling the WM_GESTURE message, I stop getting boundary feedback. Or, a gesture that worked previously does not work now.
CauseConsuming the WM_GESTURE message without handling it.
SolutionYou 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.

 

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

 

IssueI'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.
CauseSome gestures, such as the rotate gesture, are not enabled by default.
SolutionYou 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.


// 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.

 

IssueThe custom scroll bars in my application are not scrolling when I perform the pan gesture.
CauseMissing handlers for the correct WM_*SCROLL messages.
SolutionYou 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.

 

IssueI am getting delays for gestures.
CauseFlicks may be causing delays for gestures.
SolutionFlicks 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.

 

Related topics

Programming Guide

 

 

Community Additions

ADD
Show:
© 2014 Microsoft