文件如何使用剪贴板操作(ctrl-c / ctrl-v)复制/剪切/粘贴 [英] How does files get copy/cut/paste using clipboard operations (ctrl-c /ctrl-v)

查看:374
本文介绍了文件如何使用剪贴板操作(ctrl-c / ctrl-v)复制/剪切/粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图使用win32clipboard进行文本的复制粘贴操作(到现在),并且能够轻松地做到这一点,但是现在想知道如何通过文件夹/文件等完成复制/粘贴操作那。我正在使用python实现相同的目的。也找不到与此相关的任何格式。是否类似于复制文件路径,然后粘贴操作将剪贴板数据标识为文件路径,然后实际复制文件?无提示:(。

Was trying to use win32clipboard to do the copy paste operations for text (till now), and was able to do it with ease.But now am wondering how does the copy/paste operations would be accomplished for folders/files etc through that. I am using python to achieve the same. Could not also find any relevant formats for that. Is it something like file path gets copied and then paste operation identifies clipboard data as file path and then actually does the file copy? No clue :(.

推荐答案

将shell对象(例如文件或文件夹)复制到剪贴板时,shell将数据以各种不同的格式放入剪贴板中。用于此操作的剪贴板查看器显示以下格式:

When you copy a shell object (e.g. a file or a folder) to the clipboard, the shell places data into the clipboard in a variety of different formats. The clipboard viewer for such an operation shows the following formats:

老实说,我不知道随后粘贴时使用的是哪个,但是我的猜测是 Shell IDList数组。关键是文件和文件夹不会进入剪贴板,而只会引用它们。

I honestly don't know which one is used when you subsequently paste, but my guess would be the Shell IDList Array. The point is that the files and folders don't go into the clipboard, only references to them.

我相信在 MSDN:Shell剪贴板格式

这应该给您足够的指导,以便对此类功能的Python包装程序进行进一步的网络搜索(我确定它们会存在)!

That should give you enough orientation to conduct a further web search for Python wrappers to such functionality (I'm sure they will exist)!

这篇关于文件如何使用剪贴板操作(ctrl-c / ctrl-v)复制/剪切/粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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