Delphi TIPS :: A custom function IsFileInUse will return true if the file is locked for exclusive access. It would fail (return false) if the file doesn't exist at all. Two things need to be checked here: A) Is the file a READ-ONLY file? and B) Is the file in use?
Read the full article to learn how to Programmatically Check If File is In Use - Delphi Code