public Pen(uint touchPoints, FeedbackMode mode) { if (!IsSupported) { throw new ExternalException("Not Supported on your OS."); } _contact = new POINTER_PEN_INFO(); _contact.pointerInfo.pointerType = TouchApi.PT_PEN; _contact.pointerInfo.pointerId = 0; _contact.pressure = 32000; _contact.penFlags = TouchApi.PEN_FLAG_NONE; _contact.penMask = TouchApi.PEN_MASK_PRESSURE; if (!TouchApi.InitializeTouchInjection(touchPoints, (uint)mode)) { throw new ExternalException("Initialisation failed. Code: " + Marshal.GetLastWin32Error()); } }
/// <summary> /// Create a Touch emulator instance /// </summary> /// <param name="touchPoints">Number of concurrent touch points</param> /// <param name="mode">Feedback mode</param> public Touch(int touchPoints, FeedbackMode mode) { if (!IsSupported) { throw new ExternalException("Not Supported on your OS."); } _contact = new POINTER_TOUCH_INFO(); _contact.pointerInfo.pointerType = TouchApi.PT_TOUCH; _contact.pointerInfo.pointerId = 0; //contact 0 _contact.orientation = 90; // Orientation of 90 means touching perpendicular to screen. _contact.pressure = 32000; _contact.touchFlags = TouchApi.POINTER_FLAG_NONE; _contact.touchMask = TouchApi.TOUCH_MASK_CONTACTAREA | TouchApi.TOUCH_MASK_ORIENTATION | TouchApi.TOUCH_MASK_PRESSURE; if (!TouchApi.InitializeTouchInjection((uint)touchPoints, (uint)mode)) { throw new ExternalException("Initialisation failed. Code: " + Marshal.GetLastWin32Error()); } }