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

WM_GESTURE, GetGestureInfo, lParam

Page 15 highlights

Gesture down) Zoom (move two fingers apart or together) Rotate (move two fingers in opposite directions or move one finger pivoting around another finger) Flicks (down and move quickly in a direction) Navigational flicks Flick left Flick right Flick up Flick down Editing flicks Flick up-left diagonal Flick down-left diagonal Flick up-right diagonal Flick down-right diagonal Note: Editing flicks are not enabled by default. You can enabled them by configure Pen and Touch settings in Windows. Equivalent message Control key + mouse scroll wheel Not applicable Forward command Back command Keyboard Scroll Down one screenful Keyboard Scroll Up one screenful Keyboard Delete Keyboard Undo Keyboard Copy Keyboard Paste The following MSDN unmanaged code excerpt shows how to catch and decode gesture messages into a gesture information structure. Basically, you need to check for WM_GESTURE messages, then call GetGestureInfo to retrieve the gesture information from lParam. The field dwID of the gesture information structure will identify the type of gestures. //catch gesture messages in WndProc LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { //. . . switch (message) { case WM_GESTURE: // Insert handler code here to interpret the gesture. return DecodeGesture(hWnd, message, wParam, lParam); //. . . } //decode gesture messages using GetGestureInfo LRESULT DecodeGesture(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){ // Create a structure to populate and retrieve the extra message info. GESTUREINFO gi; ZeroMemory(&gi, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); 15

  • 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

15
Gesture
Equivalent message
down)
Zoom
(move two fingers apart or together)
Control key + mouse scroll wheel
Rotate
(move two fingers in opposite directions or
move one finger pivoting around another finger)
Not applicable
Flicks
(down and move quickly in a direction)
Navigational flicks
Flick left
Flick right
Flick up
Flick down
Editing flicks
Flick up-left diagonal
Flick down-left diagonal
Flick up-right diagonal
Flick down-right diagonal
Note: Editing flicks are not enabled by default. You can enabled
them by configure Pen and Touch settings in Windows.
Forward command
Back command
Keyboard Scroll Down one screenful
Keyboard Scroll Up one screenful
Keyboard Delete
Keyboard Undo
Keyboard Copy
Keyboard Paste
The following MSDN unmanaged code excerpt shows how to catch and decode
gesture messages into a gesture information structure. Basically, you need to check
for
WM_GESTURE
messages, then call
GetGestureInfo
to retrieve the gesture
information from
lParam
.
The field dwID of the gesture information structure will
identify the type of gestures.
//catch gesture messages in WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
//. . .
switch (message)
{
case
WM_GESTURE
:
// Insert handler code here to interpret the gesture.
return DecodeGesture(hWnd, message, wParam, lParam);
//. . .
}
//decode gesture messages using GetGestureInfo
LRESULT DecodeGesture(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam){
// Create a structure to populate and retrieve the extra message info.
GESTUREINFO gi;
ZeroMemory(&gi, sizeof(GESTUREINFO));
gi.cbSize = sizeof(GESTUREINFO);