我怎样才能从剪贴板通知? [英] How can I get notifications from the clipboard?

查看:145
本文介绍了我怎样才能从剪贴板通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法得到通知时的剪贴板内容发生了变化? 我看了一类剪贴板。它有许多方法来设置剪贴板中的内容,但任何情况下。

Is there a way to be notified when the content of the clipboard changes? I looked a class "Clipboard". It has numerous methods to set the clipboard content but no event.

推荐答案

有没有在框架,我相信。你可以使用Win32的做到这一点,虽然。看看 SetClipboardViewer user32.dll中:

There's nothing in the Framework, I believe. You can do it with Win32, though. Look into SetClipboardViewer in User32.dll:

[DllImport("User32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);

它变得有点复杂。这不是一个简单的通知,但消息间链;你需要通过通知到下一个接收器。

It gets a little involved. It isn't a straightforward notification, but a message chain; you'll need to pass the notification on to the next receiver.

本文有必要的步骤,一个很好的说明。

This article has a good description of the steps necessary.

这篇关于我怎样才能从剪贴板通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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