WM_TOUCH 不会立即随触摸事件一起发送
我正在使用触摸屏并使用 Windows 7 内置驱动程序(因为它从未提示我安装任何驱动程序)。除了一个小问题之外,它工作得很好。当我触摸屏幕时,它不会发送 WM_LBUTTONDOWN 直到我将手指移离屏幕。这样做似乎是为了确定我是否打算按住模拟 WM_RBUTTONDOWN 。 (另外,我尝试禁用按住模拟手势,但它在实践中从未禁用。)
所以我认为我只会收到 WM_TOUCH 消息。我发现 WM_TOUCH (0x240) 也不会发送到我的窗口,直到我将手指移离屏幕。我认为这完全违背了 WM_TOUCH 的目的。
在注册接收 WM_TOUCH 消息之前和之后,我在触摸屏幕时立即收到了三个消息:
1. Send: 0x02CC (undocumented tablet messages)
2. Post: 0x011B (undocumented)
3. Send: 0x011A (WM_GESTURENOTIFY)
0x011A 是 WM_GESTURENOTIFY,我的代码要响应它(也许我没有正确响应?)。我回复标准响应(使用 MS 的示例代码)以接收完整通知。
另一件事,当我注册触摸消息时,我开始收到 WM_TOUCH 消息,但我也继续收到 WM_GESTURENOTIFY 消息。根据MS文档,一旦我注册获得WM_TOUCH,我就不再收到手势消息。
如果有人能告诉我如何立即获取 WM_TOUCH 消息(例如,当我收到 WM_GESTURENOTIFY 消息时),而不是在我将手指从触摸屏上抬起后,我将非常感激。
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.)
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.
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 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.
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看有关触摸事件的教程:
http://msdn.microsoft.com/en-us/gg464991
您要使用的是
RegisterTouchWindow
函数,如下所示:Windows 现在将发送
WM_TOUCH
消息,而不是WM_GESTURE
消息到您的窗口。请记住,您必须针对 Windows SDK 版本 7.0 或更高版本进行编译才能使其工作。Check out this tutorial on touch events:
http://msdn.microsoft.com/en-us/gg464991
What you want to use is the
RegisterTouchWindow
function, as such:Windows will now send
WM_TOUCH
messages instead ofWM_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.我几乎遇到了同样的问题并通过使用解决了它:
RegisterTouchWindow( hWnd, TWF_WANTPALM );
I almost got the same issue and solved it by using :
RegisterTouchWindow( hWnd, TWF_WANTPALM );