开发者

How does files get copy/cut/paste using clipboard operations (ctrl-c /ctrl-v)

开发者 https://www.devze.com 2023-02-11 01:08 出处:网络
Was trying to use win32clipboard to do the copy paste operations for text (till now), and was able to do it with 开发者_JAVA技巧ease.But now am wondering how does the copy/paste operations would be ac

Was trying to use win32clipboard to do the copy paste operations for text (till now), and was able to do it with 开发者_JAVA技巧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 :(.


Windows copy/paste stores things as OLE objects (http://en.wikipedia.org/wiki/Object_Linking_and_Embedding) You need a python package to deal with OLE. This thread might help- How do I script an OLE component using Python?


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:

How does files get copy/cut/paste using clipboard operations (ctrl-c /ctrl-v)

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.

I believe that there is comprehensive documentation of this on MSDN: Shell Clipboard Formats.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消