开发者

detect Windows Explorer copy operation

Is there any way to detect whenever a copy operation starts in Windows Explorer.

kind of like in Super开发者_StackOverflow社区Copier : SuperCopier Website ?

and log files involved in the operation ? and such ?

I've browsed through Supercopier code and I can't find the part which deals with detecting the copy operation, as I'm not fluid in Delphi.

P.S : it seems they are using a Shell Extension ...not sure though.


Yes, you can.

You have to implement a shell extension which has to hook the file copy operation. There are plenty of examples of how to do these things in C++ (using the native Win32 API) and also using C# or other .NET framework languages. I'm sure you can use Delphi too but I don't know the details involved in making the Win32 API calls..

Here's an article which details the implementation of a simple shell extension in C#.

Of course, you may also want to take a look at windows file I/O filters, although they only allow you to observe file operations such as creating, copying, changing or deleting. In .NET creating a file I/O filter is trivial using the System.IO.FileSystemWatcher class and if all you want is to detect and log such file copy operations it may be all you need to do.

NOTE If you decide to implement a shell extension in C#, you should know that it will only work on operating systems where the .NET framework has been installed (the version that you used to create the extension) - although most people now have at least .NET 1.1, and 2.0..


Examples of creating a copy hook shell extension can be found in the installation delphi folder \Demos\ActiveX\ShellExt\copyhook.dpr

Here you have another additional example

  • A Copy Hook for Pascal Files

Bye.


You don't need any Shell extension.
You just have to hook Shell apis.


The easiest way to detect Windows Explorer is checking the Clipboard. Of course it doesn't work in drag'n drop case, mcd command or TotalCommander.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜