在 C++ 中检测触摸板事件建设者
我正在 C++ Builder 中编写一个 API,用于收集 Windows 笔记本电脑触摸板上的事件信息。 我就是这样做的。
- 我正在创建一个窗口
- 当触摸触摸板时,
,我只需在 WM_PAINT 事件中将该信息绘制在该窗口上。但现在我不想创建该窗口(表单),我想捕获所有事件,即使用户位于桌面屏幕或另一个应用程序的窗口上。如果使用我的 API 的应用程序在后台运行,我希望能够获得这种触摸,甚至代码中的信息。我怎样才能做到这一点? 我希望你明白我的意思......实际上我想以无缝的方式做到这一点,否则白色窗体窗口会激怒用户。 我还想将这些事件保存在链接列表中,并希望从 API 中返回该事件,这可能吗? 我将非常感谢您抽出时间。我真的需要在接下来的几个小时内解决这个问题。
I am writing an API in C++ Builder that collects information for events on the touchpad of a windows laptop.
This is how I was doing it.
- I was creating a window
- when the touch pad is touched, I simply paint that information on that window in WM_PAINT event.
But now I dont want to create that window (form), i want to catch all the events, even if user is on desktop screen or on another application's window. If an application that is using my API is running in background i want to be able to get that touch even information in the code. How can I do that??
I hope you are getting my point ... actually i want to do it in a seamless way, otherwise that white form window will irritate the user.
I also want to save these events in a link list and want to return that out of the API is it possible??
I will be very thankful for your time. I really need to work it out in next few hours.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
触摸板就像其他鼠标一样。它生成标准鼠标事件。通过
SetWindowsHookEx()
使用全局WH_MOUSE
钩子来全局捕获鼠标事件。要重播它们,请使用mouse_event()
。或者,分别使用WH_JOURNALRECORD
和WH_JOURNALPLAYBACK
挂钩来进行捕获和回放。The touchpad is just a mouse like any other. It generates standard mouse events. Use a global
WH_MOUSE
hook viaSetWindowsHookEx()
to capture mouse events globally. To replay them, usemouse_event()
. Alternatively, useWH_JOURNALRECORD
andWH_JOURNALPLAYBACK
hooks instead for capture and playback, respectively.