简体   繁体   English

如何将文件路径放入剪贴板,以便可以将其作为文件粘贴到文件管理器中?

[英]How can I put a file path into the clipboard so that it can be pasted as file in a file manager?

I want the user to be able to copy a file that's stored on disk from my GTK application to a normal file manager like Nautilus. 我希望用户能够将存储在磁盘上的文件从我的GTK应用程序复制到Nautilus这样的普通文件管理器。 How can I do that? 我怎样才能做到这一点? I would prefer to just write a path into the clipboard and let the file manager take care of actually copying, is that possible? 我希望只在剪贴板中写一个路径,然后让文件管理器负责实际复制,这可能吗?

I just found an example in which it seems as if the actual file data is transferred through the clipboard – but is that the only possible way? 我只是找到一个示例,其中看起来好像实际文件数据是通过剪贴板传输的,但这是唯一可行的方法吗?

You need CF_HDROP and possibly other shell clipboard formats. 您需要CF_HDROP以及可能的其他外壳剪贴板格式。 See: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776902(v=vs.85).aspx ; 请参阅: http : //msdn.microsoft.com/zh-cn/library/windows/desktop/bb776902(v=vs.85).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何找到给定库名称(如 libfoo.so.1)的完整文件路径? - How can I find the full file path given a library name like libfoo.so.1? 如何从文件描述符中获取文件名和路径? - How can I get file name and path from file descriptor? 如果可以,我可以从文件中检索结构吗? - Can I retrieve a struct from a file if so how? 如何判断给定路径是目录还是文件? - How can i tell if a given path is a directory or a file? 如何在递归 function 中跟踪文件路径名? - How can I keep track of file path name in recursive function? 我如何修改该程序,以便它无需修改文件即可计算哈希值? - How can i modify this program so it calculates the hash without modifying the file? 如何在 C 中返回文件行号,以便我可以使用 for 循环 printf() 文件中的一系列行? - how do return a file line number in C, so that I can use a for loop to printf() a sequence of lines from the file? 如何设置fifo权限以便可以创建文件 - How to set fifo permissions so that file can be created 如何在 UNIX /tmp 目录中创建一个文件,以便所有用户都可以对其进行读写? - How do I create a file in UNIX /tmp directory so that all users can read and write to it? 如何更改函数,以便可以将整个标头解析为新文件? - How do I change my function so that the entire header can be parsed into the new file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM