(如何)我可以在Windows上模拟触摸事件吗? [英] (How) Can I emulate touch events on Windows?

查看:580
本文介绍了(如何)我可以在Windows上模拟触摸事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C ++编写的用于测试目的的实用程序当前使用 WM_TOUCH 消息正确(尽管该消息已弃用,但我仍然想验证它是否处理正确).我不需要能够将触摸事件发送到特定的HWND,仅将它们发送到桌面上的某些X/Y坐标就足够了.

A utility which I wrote in C++ for testing purposes currently uses the SendInput function to emulate user input, i.e. mouse and keyboard events. I'd now like to extend my program such that it's able to emulate touch events, such that I can verify that the tested program handles e.g. WM_TOUCH messages correctly (though that message is deprecated, I'd still like to verify that it's handled correctly). I don't need to be able to send touch events to a specific HWND, just sending them to some X/Y coordinates on the desktop is sufficient for my purposes.

我考虑使用 HARDWAREINPUT 结构与SendInput并直接发送WM_TOUCH(或WM_GESTURE?)消息,但是无论哪种情况,我都不清楚如何传递有关触摸事件发生的位置或方式的信息执行.

I considered using HARDWAREINPUT structures with SendInput as well as sending the WM_TOUCH (or WM_GESTURE?) message directly, but in either case it's not clear to me how to pass information about where or how that touch event was performed.

WM_TOUCH文档说明了lParam自变量:

包含一个触摸输入句柄,可以在对GetTouchInputInfo的调用中使用它来检索有关与此消息关联的触摸点的详细信息.

Contains a touch input handle that can be used in a call to GetTouchInputInfo to retrieve detailed information about the touch points associated with this message.

...但是尚不清楚我是否以及如何自行分配这样的触摸输入手柄".在当前进程的地址空间中,它始终只是一个普通的指针吗?如果是这样,我应该为hSource字段使用什么值. aspx"rel =" nofollow noreferrer> TOUCHINPUT 结构?

...but it's not clear if and how I can allocate such a 'touch input handle' myself. Is it always just a plain pointer in the address space of the current process? If so, what value should I use for the hSource field of the TOUCHINPUT structure?

推荐答案

您可能正在寻找 查看全文

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