如何挂接全局PASTE EVENT? [英] How to hook a global PASTE EVENT?

查看:144
本文介绍了如何挂接全局PASTE EVENT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个软件,需要知道PASTE EVENT(通过上下文菜单或ctrl + V)何时发生(仅适用于文件/目录)。或多或少,类似于TeraCopy或Copy Handler的事情。当您复制并粘贴时,它是处理粘贴的TeraCopy。

我知道或多或少知道如何捕获COPY EVENT,您只需要设置一个ClipboardViewer并捕获所有全局COPY EVENTS(其实是叫做WM_DRAWCLIPBOARD)。你可以在这里学习:
http://www.radsoftware.com。 au / articles / clipboardmonitor.aspx
但是ClipBoardViewer不能为您提供捕捉PASTE EVENT的能力。

I am developing a software that needs to know when the PASTE EVENT (through the context menu or ctrl+V) happens (only for files / directories). More or less, something like it happens with TeraCopy or Copy Handler. When you copy and then paste, it is TeraCopy that handles the pastings.
I know more or less how to capture the COPY EVENT, you only have to set a ClipboardViewer and you catch all global COPY EVENTS (in fact is called: WM_DRAWCLIPBOARD). You can learn this here: http://www.radsoftware.com.au/articles/clipboardmonitor.aspx But the ClipBoardViewer does not provide you with the ability to catch the PASTE EVENT.

推荐答案

通过粘贴进行状态更改的过程特定于各个应用程序,因此在访问剪贴板后,无法发现应用程序的状态是否更改。

The process of state change via "Pasting" is specific to individual applications, as such there is no magic way to discover whether the state of an application changed after accessing the clipboard.

最好的方法是检测应用程序是否从剪贴板检索数据。再次,没有办法知道应用程序对这些数据做了什么。知道某人打开他们的前门,不知道他们去哪里,如果有的话。类似于

The best you can do is detect whether an application has retrieved data from the clipboard. Again, there's no way of knowing what the application did with this data. It's akin to knowing someone opened their frontdoor without knowing where they went, if anywhere.

如果你想尝试这个,你可以做一些例如挂钩GetClipboardData函数。有关如何制定全系统API钩子的信息,请查看Micrsoft Detours中的示例 - http://研究.microsoft.com / sn / detours

If you do want to try this you could do something like hooking the GetClipboardData function. For information about how to palce system-wide API hooks check out the samples in Micrsoft Detours - http://research.microsoft.com/sn/detours

这篇关于如何挂接全局PASTE EVENT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆