Question

I'm trying to process the Ctrl+Z ( Undo Delete ) context menu action in my namespace extension, but I'm having trouble finding a way to do this.

I see in the doc that one needs to implement FM_UNDELETE_PROC, but no details on how to register this callback. Also tried to set a Shell hook, but no relevant messages arrive there.

Any thoughts? Also, how would one register a delete operation so the explorer would allow the Undo to take place. Now it appears if I do this from another location.

Thanks, David

Was it helpful?

Solution

Windows has per process (prior to Vista) or global file operation stack. If you use API functions like SHFileOperation or IFileOperation interface you can pass FOF_ALLOWUNDO flag BUT this flag is ignored if the source file parameter does not contain fully qualified path and file names. It means if you want use system file operation stack your shell extension objects MUST have SFGAO_FILESYSTEM attribute and you MUST return valid file path and name when IShellFolder.GetDisplayNameOf is called with SHGDN_FORPARSING parameter. Also it is necessary to implement ITransferSource and ITransferDestination interfaces. So if objects don`t not have SFGAO_FILESYSTEM attribute you must use your own implementation of operation stack.

Undo Delete command in background context menu of folder or in Edit menu is system command and it has no any relation to your shell extension. And you should not process the Ctrl+Z manually.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top