Vb.net 捕获 Ctrl+C
我想捕捉有人使用 CtrlC 的情况,即使是在焦点未对准的情况下。我正在使用 Visual Basic 2010。
I want to capture when someone uses CtrlC even when off focus. im using Visual Basic 2010.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我为您提供了一个经过验证有效的解决方案。不过,您将需要一个 C# 库,并且需要一些额外的工作,但不会太多。创建一个 C# 类库并添加一个名为“MyHooks”的类,并添加对 System.Windows.Forms.dll 和我链接到的库的引用。将使用此库的主程序将引用此 C# 库和 System.Windows.Forms。
现在在你的程序中可以做类似的事情:
Okay, so I have a solution for you that I verified works. You will need a C# library though, and a little extra work is required, but not much. Create a C# class library and add a class called 'MyHooks' and add a reference to both System.Windows.Forms.dll and the library I linked you to. Your main program that will use this will reference this C# library and System.Windows.Forms.
Now in your program can do something like:
您需要创建一个低级挂钩。 这个 CodeProject 示例 工作完美,我自己也用过它学习目的。我稍微修改了代码,但这里有一个简单的示例,说明您可以使用该库执行某些操作。同样,这只是一个示例,可能不反映最终代码,但可以轻松修改以捕获 Control+C,并且该库有详细记录。
转换为 Vb.Net
You need to create a low-level hook. This CodeProject example works perfect and I have used it myself for learning purposes. I modified the code slighty, but here is a simple example of something you could do with that library. Again, this is just an example and may not reflect the final code, but could be easily modified to capture Control+C, and the library is well documented.
Conversion to Vb.Net