Federico Pessina
Federico Pessina

Reputation: 209

Delphi Delete file - show message file is busy

I have an application that allows to perform some basic actions on file like open and delete. How can I show the same windows message as in the screenshot below when someone try to delete a file opened in any other application?

enter image description here

Upvotes: 9

Views: 841

Answers (1)

David Heffernan
David Heffernan

Reputation: 613003

Use SHFileOperation or IFileOperation to delete the file. This routes through the same code that the shell uses, and providing that you don't disable error UI then you will receive the standard dialogs in case of failure.

Upvotes: 14

Related Questions