0

When I copy/delete files from my program I can record operations and perform Undo and Redo.

But I would like to track entire system copy/delete procedures like Explorer does, so that I can perform undo even when the delete procedure has been performed from some other process, such as Explorer.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
Ivan Mark
  • 463
  • 1
  • 5
  • 17
  • you could retag your question with Windows and put 'Windows' in the title. Your question is not currently very clear and not enough accurate. – az01 Jun 28 '12 at 08:41
  • Ok, I've added > (Windows API) – Ivan Mark Jun 28 '12 at 08:47
  • As of Windows Vista, there is a system-wide undo list for file operations. That list is managed by Explorer because it's the shell. To manage the list yourself, you'd have to replace Explorer in its capacity as the shell. Instead of seeking to manage the list yourself, you should instead seek to be allowed to undo and redo operations, merely accessing the same list that Explorer already maintains for you. – Rob Kennedy Jun 28 '12 at 12:57
  • There is ReadDirectoryChanges in kernel32 (windows.pas). I wonder if this can be used for your purpose. Example project here (delphi.icm.edu.pl/ftp/d20free/dirmon.zip) – Hendra Jun 28 '12 at 14:03

1 Answers1

0

You have to use the Shellapi for that, and not the set of standard files functions of sysutils. If you copy/delete/cut with ShellExecuteEx, undo redo will be available from the explorer, even if the operation has been made within your program.

az01
  • 1,988
  • 13
  • 27
  • How would you cut/copy/delete with `ShellExecuteEx` ? Rather let the [`SHFileOperation`](http://msdn.microsoft.com/en-us/library/windows/desktop/bb762164%28v=vs.85%29.aspx) do its job here ;-) – TLama Jun 28 '12 at 08:44
  • Standard CopyFilesW etc. functions are logged somehow in some list that Explorer later can call with Undo/Redo. I would like to know which API calls Explorer uses for that. – Ivan Mark Jun 28 '12 at 08:47
  • 1
    @TLama: Actually one of my first question here, as an anonymous user, was about this...so it's possible, by using the verb 'copy' etc, cf http://stackoverflow.com/questions/3950216/winapi-shellexecuteex-using-verb-copy-on-a-file-list – az01 Jun 28 '12 at 08:48
  • This doesn't help to me - I already use CopyFiles and other API functions on hundreds of places - I need something else > when I delete file from my program Windows CAN do UNDO, which means it recorded DeleteFile call and can undo call – Ivan Mark Jun 28 '12 at 09:02
  • I haven't suggested you to use CopyFile, I've understood that you already use it. – az01 Jun 28 '12 at 11:46