C#:控制文件传输*
我想要一个在后台运行的程序,侦听任何文件传输,然后取消资源管理器的文件传输机制,并启动它自己的。
我该怎么做?有一些我可以调用的 dll 吗?
为什么?
- 一路过滤某些类型的文件。 (自动,或有提示。)
- “全部拒绝”重复传输选项。
- 记录。
- 不必每次我想传输文件时都启动程序。
- 进一步了解幕后发生的事情。
- 不依赖第三方程序。
- 我将来想到的任何附加功能。
* 我所说的文件传输是指通过拖放移动/复制文件/文件夹,但我只关心从磁盘到磁盘的文件传输,而不是从互联网的文件传输。
I'd like to have a program that runs in the background, listens for any file transfers, and then cancels explorer's file transfer mechanism, and starts it's own.
How do I do this? Is there some dll that I can pinvoke?
Why?
- To filter files of certain types along the way. (automatically, or with a prompt.)
- A "no to all" duplicate transfers option.
- Logging.
- To not have to start the program up every time I want to transfer files.
- To further understand what's going on under the hood.
- To not rely on third party programs.
- Any additional features I think of in the future.
*
By file transfers I mean moving/copying files/folders via drag and drop, but I am only concerned with file transfers from disk to disk, not from the internet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
定义“文件传输”。
你想嗅探 ftp、http 请求吗?资源管理器也复制吗?仅在本地还是在网络上?
我认为这肯定会变得脆弱。您最好的选择是,如果资源管理器让您通过 外壳扩展。我不确定是否可以做到。
请参阅编写 Shell 扩展的完整白痴指南作为起点。
另请参阅 http://msdn.microsoft.com/ en-us/library/cc144063(v=vs.85).aspx
Define "file transfer".
Do you want to sniff for ftp, http requests? Explorer copies as well? Local only or on the network?
I think this is bound to get brittle. Your best bet would be if explorer let's you hook into file copy operations via a shell extension. I'm not sure whether it can be done.
See The Complete Idiot's Guide to Writing Shell Extensions for a starting point.
See also http://msdn.microsoft.com/en-us/library/cc144063(v=vs.85).aspx
在我开始之前:这将会很糟糕,但尽管如此:
对于 Vista/7:
你需要 Hook (Hooking )
到 CoCreateInstance IFileOperation ,然后更改您的内容需要从那里。
然而,这在 XP 上不起作用,并且可能非常脆弱,只能在某些 PC 上工作,而不能在其他 PC 上工作,因为从 API 角度来看,有数百万种方法可以在 Windows 上执行相同的操作。
Before I start: This is going to finish bad, but nevertheless:
For Vista/7:
You need to Hook (Hooking)
To CoCreateInstance of IFileOperation and then change what you need from there.
This won't work on XP however, and is probably so fragile that will work on some PCs and not on others because there are millions of ways to do the same thing on windows from the API perspective.