This Article assumes that Reader is updated with these basics requirements
Touch Interactions are a high-level way of interpreting touch input data into a set of common motions such as tapping, dragging, and pinching. Lets Understand some of the common interactions used in Windows Developer Preview which are as follow:
Interaction
Description
For windows 8 developer preview this will work as it is but for other windows 8 versions you may need to change UI access permission. Lets see how to simulate these Touch interaction via VC++ code using Touch Injection API.
By Tap we mean that it has simply touched any portion of screen. In this use case actor takes two action
To get above done you need to following 5 steps.
Create a Win32 application using visual studio 2011 developer preview. ( with No CLR support and without ATL support)
In the WinMain Method Initialize the Touch Injection API refer code below.
POINTER_TOUCH_INFO contact;
InitializeTouchInjection(1, TOUCH_FEEDBACK_DEFAULT); // Here number of contact point is declared as 1.
memset(&contact, 0, sizeof(POINTER_TOUCH_INFO));
contact.pointerInfo.pointerType = PT_TOUCH;
contact.pointerInfo.pointerId = 0; //contact 0
contact.pointerInfo.ptPixelLocation.y = 200; // Y co-ordinate of touch on screen
contact.pointerInfo.ptPixelLocation.x = 300; // X co-ordinate of touch on screen
contact.touchFlags = TOUCH_FLAG_NONE;
contact.touchMask = TOUCH_MASK_CONTACTAREA | TOUCH_MASK_ORIENTATION | TOUCH_MASK_PRESSURE;
contact.orientation = 90; // Orientation of 90 means touching perpendicular to screen.
contact.pressure = 32000;
// defining contact area (I have taken area of 4 x 4 pixel)
contact.rcContact.top = contact.pointerInfo.ptPixelLocation.y - 2;
contact.rcContact.bottom = contact.pointerInfo.ptPixelLocation.y + 2;
contact.rcContact.left = contact.pointerInfo.ptPixelLocation.x - 2;
contact.rcContact.right = contact.pointerInfo.ptPixelLocation.x + 2;
contact.pointerInfo.pointerFlags = POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
InjectTouchInput(1, &contact); // Injecting the touch down on screen
contact.pointerInfo.pointerFlags = POINTER_FLAG_UP;
InjectTouchInput(1, &contact); // Injecting the touch Up from screen
By Hold it mean that Touch is continuously in contact to the screen. In this use case actor takes two action