HP Dx9000 Resources for Developing Touch-Friendly Applications for HP Business - Page 17

Touch Input Messages

Page 17 highlights

 ullArguments shows more information about the gesture (for example, the distance between the two points of a zoom) You can configure the gesture messages sent from Windows by calling SetGestureConfig. Typical usages are disabling/enabling gestures, blocking/receiving vertical/horizontal and gutter and inertia for single finger panning. A few things to consider when handling WM_GESTURE:  Do not call RegisterTouchWindow. Your application will stop receiving WM_GESTURE messages.  Ignore the gesture starting and ending messages (GID_BEGIN and GID_END). The default gesture handler uses these. Application behavior is undefined if your application consumes these.  Pass unconsumed messages to DefWindowProc to ensure all messages are handled appropriately.  Call CloseGestureInfoHandle to close the gesture input handle for messages that your application handles.  Note that compound gestures are coalesced. For example, a touch gesture starting as a zoom then changing to panning will result in only a zoom gesture message. If you want to respond exactly to zooming then panning, you need to handle WM_TOUCH instead of WM_GESTURE and detect the gesture change yourself. More details about touch support in Windows 7® are available on MSDN at http://msdn.microsoft.com/en-us/library/dd562197(VS.85).aspx. Touch Input Messages Touch input messages gives you the raw touch data and all the freedom to interpret it. Associate the raw touch points to the target objects and figure out what action a user or users intend to do. The following unmanaged MSDN code excerpts show the different steps to getting touch input messages: test the capabilities of the input digitizer, register to receive touch input messages and handle the messages.Test the capability of the touchscreen: #include . . . // test for touch int value = GetSystemMetrics(SM_DIGITIZER); if (value & NID_READY){ /* stack ready */} if (value & NID_MULTI_INPUT){ /* digitizer is multitouch */ MessageBoxW(hWnd, L"Multitouch found", L"IsMulti!", MB_OK); } if (value & NID_INTEGRATED_TOUCH){ /* Integrated touch */} 17

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37

17
ullArguments
shows more information about the gesture (for example, the
distance between the two points of a zoom)
You can configure the gesture messages sent from Windows by calling
SetGestureConfig
. Typical usages are disabling/enabling gestures,
blocking/receiving vertical/horizontal and gutter and inertia for single finger
panning.
A few things to consider when handling WM_GESTURE:
Do not call
RegisterTouchWindow
. Your application will stop receiving
WM_GESTURE messages.
Ignore the gesture starting and ending messages (GID_BEGIN and GID_END).
The default gesture handler uses these. Application behavior is undefined if
your application consumes these.
Pass unconsumed messages to
DefWindowProc
to ensure all messages are
handled appropriately.
Call
CloseGestureInfoHandle
to close the gesture input handle for messages
that your application handles.
Note that compound gestures are coalesced. For example, a touch gesture
starting as a zoom then changing to panning will result in only a zoom gesture
message. If you want to respond exactly to zooming then panning, you need to
handle WM_TOUCH instead of WM_GESTURE and detect the gesture change
yourself.
More details about touch support in Windows 7® are available on MSDN at
.
Touch Input Messages
Touch input messages gives you the raw touch data and all the freedom to
interpret it. Associate the raw touch points to the target objects and figure out what
action a user or users intend to do. The following unmanaged MSDN code
excerpts show the different steps to getting touch input messages: test the
capabilities of the input digitizer, register to receive touch input messages and
handle the messages.Test the capability of the touchscreen:
#include <windows.h>
. . .
// test for touch
int value =
GetSystemMetrics(SM_DIGITIZER)
;
if (value & NID_READY){ /* stack ready */}
if (value
& NID_MULTI_INPUT){
/* digitizer is multitouch */
MessageBoxW(hWnd, L"Multitouch found", L"IsMulti!", MB_OK);
}
if (value &
NID_INTEGRATED_TOUCH
){ /* Integrated touch */}