如何获取剪贴板粘贴通知,并提供我自己的数据? [英] How to get a clipboard paste notification and provide my own data?

查看:167
本文介绍了如何获取剪贴板粘贴通知,并提供我自己的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关一个小工具,我写(.NET,C#),我希望监视剪贴板复制操作和剪贴板粘贴操作。

For a small utility I am writing (.NET, C#), I want to monitor clipboard copy operations and clipboard paste operations.

我的想法是提供粘贴到任意应用程序的时候,我自己的数据。

My idea is to provide my own data when pasting into an arbitrary application.

复制操作的监控可以通过轻松完成一个剪贴板查看器

The monitoring of a copy operation can be easily done by using a clipboard viewer.

东西似乎更先进的对我来说是写一个剪贴板粘贴商:

Something that seems much more advanced to me is to write a "clipboard paste provider":

  • 答案为是什么格式都可以的应用程序的查询。
  • 供应数据应用粘贴操作。

我发现此张贴此张贴,但没有人似乎真的帮我

I found this posting and this posting, but none of them seems to really help me.

我的猜测是,我无论如何都模仿/劫持当前剪贴板中。

What I guess is that I somehow have to mimic/hijack the current clipboard.

问:

是否可以包装剪贴板粘贴操作而言,提供我自己的一种剪贴板代理?

Is it possible to "wrap" the clipboard in terms of paste operations and provide my own kind of "clipboard proxy"?

推荐答案

您需要使用Windows钩子钩在剪贴板挂钩。一个windows钩子截获全球发生的事件,并提供自己的钩子程序更换或拦截消息的方式。看看这里 $ C $的CProject 解释如何挂钩。这里有一个剪贴板助手侦听复制/粘贴功能。这里有一个剪贴板间谍,仅仅做到这一点。下面是实现一个剪贴板钩的另一篇文章。

You need to hook in the clipboard hook by using a windows hook. A windows hook is a way of intercepting global events happening and providing your own hook procedure to replace or intercept the message. Have a look here on CodeProject that explains how to hook. Here's a clipboard helper that listens for the copy/paste functionality. Here's a Clipboard spy that just does that. Here's another article that implements a Clipboard hook.

希望这会有所帮助, 诚挚的问候, 汤姆。

Hope this helps, Best regards, Tom.

这篇关于如何获取剪贴板粘贴通知,并提供我自己的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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