更改通过钩子的击键(c/c++)

发布于 2024-08-09 05:34:47 字数 176 浏览 1 评论 0 原文

是否可以使用 winapi 键盘挂钩编辑击键?好吧,不需要键盘挂钩,而是类似的东西..

我想做这样的事情:

用户按下键“A”,

我的函数将 1 添加到虚拟键码(只是一个例子),

“A”变成“B”

,然后“B”已发送至目标应用程序,

谢谢!

is it possible to edit a keystroke using a winapi keyboard hook? well, not neccesary a keyboard hook but something like it..

i wanna do something like this:

user presses key 'A'

my function adds 1 to the virtual keycode (just an example)

the 'A' becomes an 'B'

and the 'B' is sent to the destination application

thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

空宴 2024-08-16 05:34:47

首先,您需要一个Keyboardhook。您安装一个过滤器,过滤器函数接收虚拟键代码和键盘挂钩时键盘的状态。然后您可以更改虚拟键代码。

其他链接:

http://msdn.microsoft.com/ en-us/library/ms644990(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms644984(VS.85).aspx

First, you need a Keyboardhook. You install a filter and the filter function receives the virtual-key code and the state of the keyboard at the time of the keyboard hook. Then you can change the virtual-key code.

Additional Links:

http://msdn.microsoft.com/en-us/library/ms644990(VS.85).aspx

http://msdn.microsoft.com/en-us/library/ms644984(VS.85).aspx

━╋う一瞬間旳綻放 2024-08-16 05:34:47

我认为你可以通过应用键盘钩子消耗用户输入的击键来做到这一点。
并生成你想要的角色的key_event。

I think you can do it by eating up the keystroke entered by user by applying keyboard hook.
and generating key_event of the character you want.

油饼 2024-08-16 05:34:47

您无法直接更改 KBDLLHOOKSTRUCT 中的虚拟键值。
相反,在使用修改后的虚拟键值发送消息后,在挂钩函数中返回 1。

You can't change the virtual key value in the KBDLLHOOKSTRUCT directly.
Instead, return 1 in the hook function after you sendmessage with your modified virtual key value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文