C#中的复制/粘贴事件侦听器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1156975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 09:34:54  来源:igfitidea点击:

copy/paste event listener in C#

c#copy-paste

提问by

I'm new to C# (I'm used to Java) and am trying to implement a listener that can run in the background of a Windows XP computer and be able to see when a user does a copy, cut, or paste operation.
I found this pageand have attempted to implement that listener, but I keep having problems.

我是 C# 新手(我已经习惯了 Java)并且正在尝试实现一个可以在 Windows XP 计算机后台运行的侦听器,并且能够看到用户何时进行复制、剪切或粘贴操作。
我找到了这个页面并试图实现那个监听器,但我一直遇到问题。

My question is two fold: one, will the listener on this page solve my problem? and if so, any tips on implementing it? I'm getting:

我的问题有两个:一,这个页面上的听众会解决我的问题吗?如果是这样,关于实施它的任何提示?我越来越:

The type or namespace name 'DragDropOrCopyPasteEventArgs' could not be found (are you missing a using directive or an assembly reference?)

找不到类型或命名空间名称“DragDropOrCopyPasteEventArgs”(您是否缺少 using 指令或程序集引用?)

I've tried attaching the necessary assembly reference, but I don't seem to have the correct dll.

我已经尝试附加必要的程序集参考,但我似乎没有正确的 dll。

Thanks a ton in advance. (before anyone asks, I am not writing a virus, its a writing analyzer)

提前致谢。(在有人问之前,我不是在写病毒,它是一个写作分析器)

采纳答案by TheVillageIdiot

For copy listener please look into this question hereand an article here.

对于复制听众,请在此处查看此问题并在此处查看文章。

As for the paste event as discussed in the above thread there seems to be some confusion as clipboard listener does not provides any feedback on pasting. You may have to install global hooks to capture CTRL + V and mouse context menu.

至于上面线程中讨论的粘贴事件,似乎有些混乱,因为剪贴板侦听器不提供任何关于粘贴的反馈。您可能需要安装全局钩子来捕获 CTRL + V 和鼠标上下文菜单。

for using key hook please read this CodeProjectarticle.

要使用 key hook,请阅读这篇CodeProject文章。

for listening to mouse events and movement please visit this another CodeProjectarticle and thismsdn page about WIN 32 hooks.

听鼠标事件和移动请访问此另一个CodeProject上的文章,对WIN 32钩MSDN页面。