Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi Delete file - show message file is busy

Tags:

winapi

delphi

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

like image 927
Federico Pessina Avatar asked May 22 '17 09:05

Federico Pessina


1 Answers

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.

like image 144
David Heffernan Avatar answered Sep 24 '22 03:09

David Heffernan