如何区分CUT和COPY [英] How to distinguish between CUT and COPY

查看:188
本文介绍了如何区分CUT和COPY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当GetClipboardData()用于访问剪贴板捕获的数据时,是否有API调用或标志来区分复制操作(CTRL + C)和剪切操作(CTRL + X)?



我尝试过的事情:



搜索网页。一般来说,在剪贴板捕获的数据时,我找不到任何关于剪切和复制之间差异的文档

解决方案

No。你无法分辨,因为将它放在剪贴板上的应用程序:

1)除了这里有一些数据,它就是这种类型之外,不告诉剪贴板

2)根本不必遵守正常剪切或复制规则:它可以将文本移动到存档,并将其复制到剪贴板。

3)不要必须有任何类型的用户输入才能将数据加载到剪贴板 - 它可以通过计时器自动将RSS源中的数据加载到剪贴板上,以便向其他应用程序发出粘贴指令消息。



所以,没有。根本没有办法告诉。


如解决方案1中所述和评论:

没有一般方法可以知道源端发生了什么。



但有一个例外:粘贴删除操作

这些用于剪切文件时(例如,从Windows资源管理器中)。



当源请求目标通过向剪贴板数据添加其他对象来执行粘贴操作时获取通知。当一个目标检测到这样的请求时,它知道源端有一个切割操作(并且它应该正确行动)。



参见部分处理处理Shell数据传输方案(Windows),处理粘贴时删除操作 [ ^ ]了解其工作原理。

When GetClipboardData() is used to access the data captured by the Clipboard, is there an API call or flag to distinguish between a Copy action (CTRL+C) and a Cut action (CTRL+X)?

What I have tried:

Searching the web. Generally speaking, I couldn't find any documentation about the difference between Cut and Copy when it comes to data captured by the Clipboard

解决方案

No. You can't tell, because the application which places it on the clipboard:
1) Doesn't tell the clipboard anything other than "here is some data, it's this type"
2) Doesn't have to obey "normal" cut or copy rules at all: it could for example move text to an archive, and copy it to the clipboard.
3) Doesn't have to have a user input of any kind in order to load data to the clipboard - it could be automated via a timer to load data from an RSS feed onto the clipboard in order to issue a "paste" instruction message to a different app.

So, no. No way to tell at all.


As said in solution 1 and the comments:
There is no general way to know what had happened on the source side.

But there is one exception: Delete-on-Paste Operations
These are used when cutting files (e.g. from within the Windows Explorer).

With those the source requests the target to get informed when a paste operation has been performed by adding an additional object to the clipboard data. When a target detects such requests, it knows that there was a cut operation at the source side (and that it should act acordingly).

See the section Handling Delete-on-Paste Operations at Handling Shell Data Transfer Scenarios (Windows)[^] for how it works.


这篇关于如何区分CUT和COPY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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