有没有一种方法来模拟在Windows触摸事件8 [英] Is there a way to simulate touch events in Windows 8

查看:1825
本文介绍了有没有一种方法来模拟在Windows触摸事件8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法(在Windows 7和preferably)来模拟在Windows 8触摸事件。结果
我知道有一个项目,称为多点触摸Vista的,但我觉得它有点矫枉过正,我从来没有得到它与多屏幕正常工作。结果
我想要做的是很简单的,我想开始一个应用程序,可以发送触摸事件到Windows不需要多个鼠标之类的任何事情。结果
能不能做到或者我需要一个(MMV)驱动程序来做到这一点?

Is there a way to simulate touch events in Windows 8 (and preferably in windows 7).
I know there is a project called Multi touch vista but I feel its a bit overkill and I never got it working correctly with multiple screens.
What I want to do is very simple, I want to start an app that can send touch events to Windows no need for multiple mice or any thing like that.
Can it be done or do I need a (MMV) driver to do that?

由于结果
/吉米

Thanks
/Jimmy

推荐答案

我一直在寻找类似的东西,发现这篇文章<一个href=\"http://social.technet.microsoft.com/wiki/contents/articles/6460.simulating-touch-input-in-windows-developer-$p$pview-using-touch-injection-api-en-us.aspx?PageIndex=2\">Simulating采用触摸注射API 和样本触摸输入在Windows开发人员preVIEW code (C ++)可以回答你的问题。然而,这似乎只在Windows 8(而不是Windows 7)。

I was looking for something similar and found this article Simulating Touch Input in Windows Developer preview using Touch Injection API and sample code (C++) may answer your question. However, this seems to work only on Windows 8 (not Windows 7).

它模拟点击,按住,拖动,捏/平移,旋转和十字滑台。

It simulates Tap, Hold, Drag, Pinch/Pan, Rotate and Cross-Slide.

下面是触摸(TAP)code:

Here is the touch (Tap) code:

POINTER_TOUCH_INFO contact;
InitializeTouchInjection(1, TOUCH_FEEDBACK_DEFAULT); // Here number of contact point is declared as 1.
memset(&contact, 0, sizeof(POINTER_TOUCH_INFO)); 

contact.pointerInfo.pointerType = PT_TOUCH;
contact.pointerInfo.pointerId = 0;          //contact 0
contact.pointerInfo.ptPixelLocation.y = 200; // Y co-ordinate of touch on screen
contact.pointerInfo.ptPixelLocation.x = 300; // X co-ordinate of touch on screen

contact.touchFlags = TOUCH_FLAG_NONE;
contact.touchMask = TOUCH_MASK_CONTACTAREA | TOUCH_MASK_ORIENTATION | TOUCH_MASK_PRESSURE;
contact.orientation = 90; // Orientation of 90 means touching perpendicular to screen.
contact.pressure = 32000; 

// 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;


contact.pointerInfo.pointerFlags = POINTER_FLAG_DOWN | POINTER_FLAG_INRANGE | POINTER_FLAG_INCONTACT;
InjectTouchInput(1, &contact); // Injecting the touch down on screen

contact.pointerInfo.pointerFlags = POINTER_FLAG_UP;
InjectTouchInput(1, &contact); // Injecting the touch Up from screen

另一篇文章:开始使用Windows触摸手势

这篇关于有没有一种方法来模拟在Windows触摸事件8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆