剪贴板文件文件夹路径读取 [英] clipboard file folder path reading

查看:77
本文介绍了剪贴板文件文件夹路径读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读问题
1.源文件的地址
2.目标文件的地址

例如,如果用户将文件textX.txt从文件夹C:\ Document复制到文件夹E:\ Data,则我的应用程序应捕获:源地址为C:\ Document \ textX.txt,目标地址为E:\ Data \ textX.txt

我已经使用过SystemFileWatcher,但是它只能捕获目标地址.

Problem in reading
1. The address of the source file
2. The address of the destination file

For example, if the user copy file textX.txt from folder C:\Document to folder E:\Data , my application should catch : The source address as C:\Document\textX.txt and The destination address as E:\Data\textX.txt

I already used SystemFileWatcher, but it can catch the destionation address only. How can I get the source address as well?

推荐答案

您应该在codeproject上查看此文章.

VBDT全局Windows挂钩

Yaca,剪贴板小助手.

他们使用Windows Hook在剪贴板上获取一个句柄,然后您可以确定何时复制对象以及何时粘贴对象.

如果剪贴板包含这样的文件路径,则可以获取剪贴板的内容.

You should check this articles here on codeproject.

VBDT Global Windows Hook

Yaca, Clipboard little helper.

They use Windows Hook to get a handle on the clipboard, you can then determine when an object is copied and when it is pasted.

You can get the content of the clipboard if it contains a Filepath like this.

using System.Collections.Specialized; //a namespace.
            StringCollection files = Clipboard.GetFileDropList();
            if (files != null)
            {
                foreach (string file in files)
                {
                    MessageBox.Show(file);
                }
            }


这篇关于剪贴板文件文件夹路径读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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