public void OutOfRange() { _contact.pointerInfo.pointerFlags = TouchApi.POINTER_FLAG_UPDATE | TouchApi.POINTER_FLAG_UP; var args = new[] { _contact }; if (!TouchApi.InjectTouchInput(1, args)) { throw new ExternalException("Injection failed. Code: " + Marshal.GetLastWin32Error()); } }
public void Hover(int x, int y) { _contact.pointerInfo.ptPixelLocation.X = x; // Y co-ordinate of touch on screen _contact.pointerInfo.ptPixelLocation.Y = y; // X co-ordinate of touch on screen _contact.pointerInfo.pointerFlags = TouchApi.POINTER_FLAG_UPDATE | TouchApi.POINTER_FLAG_INRANGE; var args = new[] { _contact }; if (!TouchApi.InjectTouchInput(1, args)) { throw new ExternalException("Injection failed. Code: " + Marshal.GetLastWin32Error()); } }
public void Touchdown(int x, int y) { _contact.pointerInfo.ptPixelLocation.X = x; // Y co-ordinate of touch on screen _contact.pointerInfo.ptPixelLocation.Y = y; // X co-ordinate of touch on screen _contact.pointerInfo.pointerFlags = TouchApi.POINTER_FLAG_DOWN | TouchApi.POINTER_FLAG_INRANGE | TouchApi.POINTER_FLAG_INCONTACT; // defining contact area (I have taken area of 4 x 4 pixel) var args = new[] { _contact }; if (!TouchApi.InjectTouchInput(1, args)) { throw new ExternalException("Injection failed. Code: " + Marshal.GetLastWin32Error()); } }
/// <summary> /// Keep pressed /// </summary> public void Hold() { //_contact.pointerInfo.ptPixelLocation.X = x; // Y co-ordinate of touch on screen //_contact.pointerInfo.ptPixelLocation.Y = y; // X co-ordinate of touch on screen _contact.pointerInfo.pointerFlags = TouchApi.POINTER_FLAG_UPDATE | TouchApi.POINTER_FLAG_INRANGE | TouchApi.POINTER_FLAG_INCONTACT; // 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; POINTER_TOUCH_INFO[] args = new[] { _contact }; if (!TouchApi.InjectTouchInput(1, args)) { throw new ExternalException("Initialisation failed. Code: " + Marshal.GetLastWin32Error()); } }