>If I delete a file and this one is used by an other application an error occur. It's possible to know trough a VFP or API function if a file is used by an other application?
>
>Thanks
>david
Yes, you could open the file with fopen(). If this returns -1, the file is used elsewhere.
You could also just use error handling with the command that deletes the file. A simple example follows.
local llError, lcOnError
lcOnError = on("error")
on error llError = .T.
erase MyFile.xyz
on error &lcOnError
if llError
MessageBox("Can't erase the file for some reason.")
endif
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)