全局挂钩(非活动程序)
我正在创建一个程序,允许您粘贴文本,但它看起来就像您在粘贴时键入它,粘贴打字机。
我想使用 Ctrl + b
来启动粘贴,但我遇到了热键问题。
我认为我需要的是使用 WH_KEYBOARD_LL
挂钩并包含该 user32 文件,但在添加它和命名空间时通常会出现错误。
我最接近这个:http://thedarkjoker94.cer33.com/?p=111 - 但它似乎不适用于 Ctrl
、alt
和其他修饰符,即使我使用 KeyData
也是如此。
我需要一种方法来制作即使程序不是活动窗口也能工作的热键。这是 Microsoft Visual C# 2010 中的一个 Windows 窗体应用程序。StackOverlow
主题有很多,但它们已经过时,而且不够完整,无法让我运行某些东西。
I am creating a program that allows you to paste text but it will look like you are typing it as it pastes, Paste Typer.
I am wanting to use Ctrl + b
to set off the pasting, but I am having issues with hotkeys.
I think what I need is to use a WH_KEYBOARD_LL
hook and include that user32 file but I usually get errors when I add it and the namespace.
I have come closest with this: http://thedarkjoker94.cer33.com/?p=111 - but it doesn't seem to work with Ctrl
, alt
and other modifiers, even when I used KeyData
.
I need a way to make a hotkey that will work even when the program is not the active window. This is a windows forms application in Microsoft Visual C# 2010.
There a rea lot of StackOverlow topics but they are dated and are not complete enough for me to get something running.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在谈论 HookManager 吗?
我成功地使用了它,如下所示:
我
创建了 Keyboard 类,代码如下:
Are you talking about the HookManager?
I use it successfully like this:
and
I created the Keyboard class here is the code: