Sign in to follow this  
Followers 0
rektmuch

how to simulate a multitouch

1 post in this topic

i need to touch on multiple locations on screen i got this script form an old thread it works for 1 click but couldnt manage to make it multiple please help me if you can

 

Global Const $tagPOINT = "struct; long X;long Y; endstruct;"
Global Const $tagRECT = "struct; long Left;long Top;long Right;long Bottom; endstruct;"


Global Const $tagPOINTER_INFO = "struct;struct;int pointerType;int pointerId;int frameId;int pointerFlags;hwnd sourceDevice;hwnd hwndTarget;struct;int ptPixelLocation_x;int ptPixelLocation_y;endstruct; struct;int ptHimetricLocation_x;" & _
                                    "int ptHimetricLocation_y;endstruct; struct;int ptPixelLocationRaw_x;int ptPixelLocationRaw_y;endstruct;struct;int ptHimetricLocationRaw_x;int ptHimetricLocationRaw_y;endstruct;dword dwTime;" & _
                                    "int historyCount;int inputData;dword dwKeyStates;UINT64 PerformanceCount;int ButtonchangeType;endstruct;"


Global Const $tagPOINTER_TOUCH_INFO = $tagPOINTER_INFO & "int touchFlags;int touchMask;struct;int rcContact_left;int rcContact_right;int rcContact_top;int rcContact_bottom;endstruct;struct;int rcContactRaw_left;int rcContactRaw_right;" & _
                                                    "int rcContactRaw_top;int rcContactRaw_bottom;endstruct;int orientation;int pressure;endstruct;"
Global Const $TOUCH_FEEDBACK_DEFAULT    = 0x1
Global Const $TOUCH_FEEDBACK_INDIRECT   = 0x2
Global Const $TOUCH_FEEDBACK_NONE       = 0x3

Global Const $PT_POINTER   = 0x00000001
Global Const $PT_TOUCH     = 0x00000002
Global Const $PT_PEN       = 0x00000003
Global Const $PT_MOUSE     = 0x00000004
Global Const $PT_TOUCHPAD  = 0x00000005

Global Const $TOUCH_MASK_NONE           = 0x00000000
Global Const $TOUCH_MASK_CONTACTAREA    = 0x00000001
Global Const $TOUCH_MASK_ORIENTATION    = 0x00000002
Global Const $TOUCH_MASK_PRESSURE       = 0x00000004

Global Const $POINTER_FLAG_NONE             = 0x00000000
Global Const $POINTER_FLAG_NEW              = 0x00000001
Global Const $POINTER_FLAG_INRANGE          = 0x00000002
Global Const $POINTER_FLAG_INCONTACT        = 0x00000004
Global Const $POINTER_FLAG_FIRSTBUTTON      = 0x00000010
Global Const $POINTER_FLAG_SECONDBUTTON     = 0x00000020
Global Const $POINTER_FLAG_THIRDBUTTON      = 0x00000040
Global Const $POINTER_FLAG_FOURTHBUTTON     = 0x00000080
Global Const $POINTER_FLAG_FIFTHBUTTON      = 0x00000100
Global Const $POINTER_FLAG_PRIMARY          = 0x00002000
Global Const $POINTER_FLAG_CONFIDENCE       = 0x00004000
Global Const $POINTER_FLAG_CANCELED         = 0x00008000
Global Const $POINTER_FLAG_DOWN             = 0x00010000
Global Const $POINTER_FLAG_UPDATE           = 0x00020000
Global Const $POINTER_FLAG_UP               = 0x00040000
Global Const $POINTER_FLAG_WHEEL            = 0x00080000
Global Const $POINTER_FLAG_HWHEEL           = 0x00100000
Global Const $POINTER_FLAG_CAPTURECHANGED   = 0x00200000

Tap()

Func Tap()
    DllCall('User32.dll','BOOL','InitializeTouchInjection','int',1,'dword',$TOUCH_FEEDBACK_INDIRECT)
    If @error Then
        Return -1
    Else
        Local $tPOINTER_TOUCH_INFO = DllStructCreate($tagPOINTER_TOUCH_INFO)
        DllStructSetData($tPOINTER_TOUCH_INFO,1,$PT_TOUCH)
        DllStructSetData($tPOINTER_TOUCH_INFO,2,0)
        DllStructSetData($tPOINTER_TOUCH_INFO,7,300)
        DllStructSetData($tPOINTER_TOUCH_INFO,8,300)
        DllStructSetData($tPOINTER_TOUCH_INFO,21,0x00000000)
        DllStructSetData($tPOINTER_TOUCH_INFO,22,BitOR($TOUCH_MASK_CONTACTAREA,$TOUCH_MASK_ORIENTATION,$TOUCH_MASK_PRESSURE))
        DllStructSetData($tPOINTER_TOUCH_INFO,23,DllStructGetData($tPOINTER_TOUCH_INFO,7)-2)
        DllStructSetData($tPOINTER_TOUCH_INFO,25,DllStructGetData($tPOINTER_TOUCH_INFO,7)+2)
        DllStructSetData($tPOINTER_TOUCH_INFO,24,DllStructGetData($tPOINTER_TOUCH_INFO,8)-2)
        DllStructSetData($tPOINTER_TOUCH_INFO,26,DllStructGetData($tPOINTER_TOUCH_INFO,8)+2)

        DllStructSetData($tPOINTER_TOUCH_INFO,31,90)
        DllStructSetData($tPOINTER_TOUCH_INFO,32,1024)

        DllStructSetData($tPOINTER_TOUCH_INFO,4,BitOR($POINTER_FLAG_DOWN,$POINTER_FLAG_INRANGE,$POINTER_FLAG_INCONTACT))
        DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO))

        If @error Then
            Return -2
        Else
            DllStructSetData($tPOINTER_TOUCH_INFO,4,$POINTER_FLAG_UP)
            DllCall('User32.dll','BOOL','InjectTouchInput','int',1,'ptr',DllStructGetPtr($tPOINTER_TOUCH_INFO))
            If @error Then
                Return -3
            Else
                Return True
            EndIf
        EndIf
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0