WM_TOUCH 不会立即与触地事件一起发送 [英] WM_TOUCH is not immediately sent with touch down event

查看:31
本文介绍了WM_TOUCH 不会立即与触地事件一起发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用触摸屏并使用 Windows 7 内置驱动程序(因为它从未提示我安装任何驱动程序).它工作正常,除了一个小问题.当我触摸屏幕时,它不会发送 WM_LBUTTONDOWN,直到我将手指移离屏幕.这样做似乎是为了确定我是否打算按住以模拟 WM_RBUTTONDOWN.(此外,我尝试禁用按住模拟手势,但在实践中从未禁用.)

I am working with a touch screen and using Windows 7 built in drivers (as it never prompted me to install any). it works fine, except for one small issue. When I touch the screen, it will not send the WM_LBUTTONDOWN until I move my finger off the screen. It appears to do this to determine if I intend to hold down to emulate WM_RBUTTONDOWN or not. (Also, I tried to disable the hold down emulate gesture, but it never disables in practice.)

所以我想我只会收到 WM_TOUCH 消息.而且我发现 WM_TOUCH (0x240) 也不会发送到我的窗口,直到我将手指移离屏幕.我认为这完全违背了 WM_TOUCH 的目的.

So I thought I would just receive the WM_TOUCH messages. And I found that WM_TOUCH (0x240) is also not sent to my window until I move my finger off the screen. I sort of thought that defeats the purpose of WM_TOUCH altogether.

在注册接收 WM_TOUCH 消息之前和之后,我在触摸屏幕时立即收到了三个消息:

Both before and after registering to receive WM_TOUCH messages, I received three messages immediately upon touching the screen:

1. Send: 0x02CC (undocumented tablet messages)
2. Post: 0x011B (undocumented)
3. Send: 0x011A (WM_GESTURENOTIFY)

0x011A 是 WM_GESTURENOTIFY,我的代码要响应它(也许我没有正确响应?).我以标准回复(使用 MS 的示例代码)回复以接收完整通知.

0x011A is WM_GESTURENOTIFY, which my code is to respond to (perhaps I am not responding correctly?). I reply with a standard response (using sample code from MS) to receive full notifications.

另一件事,当我注册触摸消息时,我开始收到 WM_TOUCH,但我也继续收到 WM_GESTURENOTIFY 消息.根据 MS 文档,一旦我注册获得 WM_TOUCH,我就不再收到手势消息.

Another thing, I began getting WM_TOUCH when I register for touch messages, but I continue to get the WM_GESTURENOTIFY message as well. According to the MS documentation, once I register to get WM_TOUCH, I no longer get gesture messages.

如果有人能告诉我如何立即获取 WM_TOUCH 消息(例如,当我收到 WM_GESTURENOTIFY 消息时),而不是在我的手指离开触摸屏之后,我将不胜感激.

If anyone can tell me how to get WM_TOUCH messages immediately (e.g. when I am getting the WM_GESTURENOTIFY messages), and not after I let my finger up off the touch scree, I would appreciate it much.

推荐答案

查看有关触摸事件的教程:

Check out this tutorial on touch events:

http://msdn.microsoft.com/en-us/gg464991

您要使用的是RegisterTouchWindow 函数,例如:

What you want to use is the RegisterTouchWindow function, as such:

RegisterTouchWindow(handle, 0);

Windows 现在将向您的窗口发送 WM_TOUCH 消息而不是 WM_GESTURE 消息.请记住,您必须针对 Windows SDK 7.0 版或更高版本进行编译才能使其正常工作.

Windows will now send WM_TOUCH messages instead of WM_GESTURE messages to your window. Keep in mind that you will have to compile against Windows SDK version 7.0 or newer for this to work.

这篇关于WM_TOUCH 不会立即与触地事件一起发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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