Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I went ahead and create some custom functions in c++ based on the sample Microsoft provided and then went and imported that into C# using alot of the same definitions as before but without farting about with all the type checking, pointers and arguments that were causing headaches before.</p> <p>The DLL file that I've used is TouchInjectionDriver.dll and can be found here:</p> <p><a href="http://www.mediafire.com/file/do2h6m04omjweb3/TouchInjectionDriver.zip" rel="nofollow">http://www.mediafire.com/file/do2h6m04omjweb3/TouchInjectionDriver.zip</a></p> <p>Below is the C# code I used to implement it.</p> <pre><code> public enum TOUCH_MASK : uint { TOUCH_MASK_NONE = 0x00000000, TOUCH_MASK_CONTACTAREA = 0x00000001, TOUCH_MASK_ORIENTATION = 0x00000002, TOUCH_MASK_PRESSURE = 0x00000004 } public enum POINTER_INPUT_TYPE : uint { PT_POINTER = 0x00000001, PT_TOUCH = 0x00000002, PT_PEN = 0x00000003, PT_MOUSE = 0x00000004 } public enum POINTER_FLAGS : uint { POINTER_FLAG_NONE = 0x00000000, POINTER_FLAG_NEW = 0x00000001, POINTER_FLAG_INRANGE = 0x00000002, POINTER_FLAG_INCONTACT = 0x00000004, POINTER_FLAG_FIRSTBUTTON = 0x00000010, POINTER_FLAG_SECONDBUTTON = 0x00000020, POINTER_FLAG_THIRDBUTTON = 0x00000040, POINTER_FLAG_OTHERBUTTON = 0x00000080, POINTER_FLAG_PRIMARY = 0x00000100, POINTER_FLAG_CONFIDENCE = 0x00000200, POINTER_FLAG_CANCELLED = 0x00000400, POINTER_FLAG_DOWN = 0x00010000, POINTER_FLAG_UPDATE = 0x00020000, POINTER_FLAG_UP = 0x00040000, POINTER_FLAG_WHEEL = 0x00080000, POINTER_FLAG_HWHEEL = 0x00100000 } public enum TOUCH_FEEDBACK : uint { TOUCH_FEEDBACK_DEFAULT = 0x1, TOUCH_FEEDBACK_INDIRECT = 0x2, TOUCH_FEEDBACK_NONE = 0x3 } [DllImport("TouchInjectionDriver.dll", CallingConvention = CallingConvention.Cdecl)] private static extern bool InjectTouch(int x, int y, POINTER_INPUT_TYPE pt_input, int pressure, int orientation, int id, int rcContactTop, int rcContactBottom, int rcContactLeft, int rcContactRight, POINTER_FLAGS pointerFlags, TOUCH_MASK touchMask); [DllImport("TouchInjectionDriver.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void setTouchFeedback(TOUCH_FEEDBACK fb); [DllImport("TouchInjectionDriver.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void setDefaultRectSize(int size); [DllImport("TouchInjectionDriver.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void setDefaultPressure(int pres); [DllImport("TouchInjectionDriver.dll", CallingConvention = CallingConvention.Cdecl)] private static extern void setDefaultOrientation(int or); [DllImport("User32.dll")] static extern Boolean MessageBeep(UInt32 beepType); public static void mouseclick(int x, int y) { bool ret; setTouchFeedback(TOUCH_FEEDBACK.TOUCH_FEEDBACK_INDIRECT); ret = InjectTouch(x, y, POINTER_INPUT_TYPE.PT_TOUCH, 3200, 0, 0, x - 4, x + 4, y - 4, y + 4,POINTER_FLAGS.POINTER_FLAG_DOWN|POINTER_FLAGS.POINTER_FLAG_INCONTACT|POINTER_FLAGS.POINTER_FLAG_INRANGE,TOUCH_MASK.TOUCH_MASK_CONTACTAREA|TOUCH_MASK.TOUCH_MASK_ORIENTATION|TOUCH_MASK.TOUCH_MASK_PRESSURE); if (ret) { ret = InjectTouch(x, y, POINTER_INPUT_TYPE.PT_TOUCH, 3200, 0, 0, x - 4, x + 4, y - 4, y + 4, POINTER_FLAGS.POINTER_FLAG_UP, TOUCH_MASK.TOUCH_MASK_CONTACTAREA | TOUCH_MASK.TOUCH_MASK_ORIENTATION | TOUCH_MASK.TOUCH_MASK_PRESSURE); } else { MessageBeep(0); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload