Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
        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());
            }
        }
Ejemplo n.º 4
0
        /// <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());
            }
        }